/* ==========================================================================
   FarmRex – design system
   Palette sampled from the reference "Fern" dashboard + the FarmRexx logo.
   ========================================================================== */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #f8faf8;
  --text: #10201f;
  --muted: #6b7b79;
  --border: #e7ecea;
  --primary: #2f9e44;
  --primary-hover: #278a3a;
  --primary-soft: #f0faec;
  --primary-text: #1e7e34;
  --on-primary: #ffffff;
  --banner: #002625;
  --banner-2: #0a3d3a;
  --brand-blue: #035ba9;
  --brand-green: #37b34a;
  --danger: #d7085f;
  --danger-soft: #fdecf3;
  --warn: #b7860b;
  --warn-soft: #fdf6dc;
  --info: #3661ce;
  --info-soft: #e9eefc;
  --shadow: 0 1px 2px rgba(16, 32, 31, .04), 0 4px 16px rgba(16, 32, 31, .04);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #071211;
  --surface: #0f1f1e;
  --surface-2: #132726;
  --text: #e6f1ef;
  --muted: #8da4a1;
  --border: #1d3532;
  --primary: #4cc35c;
  --primary-hover: #63d273;
  --primary-soft: rgba(116, 210, 74, .13);
  --primary-text: #8be37a;
  --on-primary: #04201a;
  --banner: #002625;
  --banner-2: #0d4642;
  --danger: #ff5c93;
  --danger-soft: rgba(215, 8, 95, .18);
  --warn: #f1cb32;
  --warn-soft: rgba(241, 203, 50, .13);
  --info: #8aa6ff;
  --info-soft: rgba(54, 97, 206, .22);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto;
  transition: transform .25s ease, background .2s ease;
}
.brand { display: flex; align-items: center; padding: 4px 8px 18px; }
.brand img { height: 38px; width: auto; }
[data-theme="dark"] .brand { background: #fff; border-radius: 12px; padding: 8px 10px; margin-bottom: 14px; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 12px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: .78rem; color: var(--muted); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.35rem; margin-right: auto; }
.menu-btn { display: none; }
.org-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; background: var(--surface);
}
.org-chip svg:first-child { color: var(--primary); }
.top-divider { width: 1px; height: 28px; background: var(--border); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn .dot {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center;
}
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #5b2d0a; color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: .85rem; border: 0; cursor: pointer;
}
.user-menu { position: relative; }
.user-menu .menu {
  display: none; position: absolute; right: 0; top: 46px; width: 230px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 50;
}
.user-menu.open .menu { display: block; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu .who strong { display: block; }
.menu .who span { font-size: .8rem; color: var(--muted); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
  color: var(--text); border-radius: 8px; font: inherit; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }

.content { padding: 24px 28px 48px; max-width: 1500px; width: 100%; }
.backdrop { display: none; }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2 { font-size: 1.05rem; }
.grid { display: grid; gap: 20px; }
.dash-grid { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; gap: 14px; align-items: center; padding: 18px; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ico-green { background: var(--primary-soft); color: var(--primary-text); }
.ico-red { background: var(--danger-soft); color: var(--danger); }
.ico-blue { background: var(--info-soft); color: var(--info); }
.ico-amber { background: var(--warn-soft); color: var(--warn); }
.pos { color: var(--primary-text); } .neg { color: var(--danger); }

.banner {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 28px 32px; color: #fff; min-height: 170px;
  background: linear-gradient(100deg, var(--banner) 0%, var(--banner) 48%, rgba(0, 38, 37, .55) 100%), var(--banner);
  border: 1px solid rgba(255, 255, 255, .04); margin-bottom: 20px;
}
.banner::after {
  content: ""; position: absolute; inset: 0 0 0 42%; background: url('../images/field-tablet.jpg') center/cover;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 70%); mask-image: linear-gradient(to right, transparent, #000 70%);
  opacity: .85; z-index: 0;
}
.banner > * { position: relative; z-index: 1; }
.banner .date { font-size: .85rem; opacity: .85; }
.banner h2 { font-size: 1.5rem; margin: 6px 0 22px; font-weight: 700; }
.banner .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-white { background: #fff; color: #002625; border: 0; }
.btn-white:hover { background: #eef7ee; }
.btn-white .up { color: #f26b1d; } .btn-white .down { color: #1e7e34; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-link { background: none; color: var(--primary-text); padding-inline: 8px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

.select-pill {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7b79' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--primary-text); font: inherit; font-weight: 600; padding: 9px 36px 9px 14px; border-radius: 10px; cursor: pointer;
}

/* ---------- Donut + legend ---------- */
.summary { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: center; padding: 6px 4px 6px; }
.donut { width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center; margin: auto; }
.donut-hole { width: 86%; height: 86%; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px; }
.donut-hole small { color: var(--muted); font-size: .78rem; }
.donut-hole strong { font-size: 1.12rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.legend .name { flex: 1; min-width: 0; font-size: .92rem; }
.legend .amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .92rem; }

/* ---------- Recent entries ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); color: inherit; }
.entry:last-child { border-bottom: 0; }
.entry:hover { text-decoration: none; }
.entry .when { width: 38px; text-align: center; padding-right: 14px; border-right: 1px solid var(--border); box-sizing: content-box; }
.entry .when small { display: block; font-size: .72rem; color: var(--muted); }
.entry .when b { font-size: 1.05rem; }
.entry .what { flex: 1; min-width: 0; }
.entry .cat { font-weight: 600; font-size: .9rem; }
.entry .cat.income { color: #4fb62b; } .entry .cat.expense { color: var(--danger); }
.entry .desc { font-size: .86rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Lists on dashboard ---------- */
.rowlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.rowlist li { display: flex; align-items: center; gap: 12px; }
.rowlist .grow { flex: 1; min-width: 0; }
.rowlist .t { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowlist .s { font-size: .8rem; color: var(--muted); }
.progress { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-green), #74d24a); border-radius: 4px; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: .9rem; }

/* ---------- Bar chart ---------- */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; height: 190px; align-items: end; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; align-items: flex-end; gap: 5px; width: 100%; height: 100%; justify-content: center; }
.bar-pair i { display: block; width: 38%; max-width: 26px; border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-pair .inc { background: #74d24a; } .bar-pair .exp { background: #fa3df3; opacity: .85; }
.bar-col small { color: var(--muted); font-size: .78rem; }
.chart-legend { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---------- Page header, tables ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); flex: 1; max-width: 380px; color: var(--muted); }
.search input { border: 0; background: none; padding: 10px 0; flex: 1; font: inherit; color: var(--text); outline: none; min-width: 0; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 600; }
.table th.num { text-align: right; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions { white-space: nowrap; text-align: right; width: 1%; }
.table td.actions form { display: inline; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--primary-soft); color: var(--primary-text); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; flex-wrap: wrap; font-size: .88rem; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination .pages a, .pagination .pages span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); color: var(--text); }
.pagination .pages a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .pages .current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; }
.pagination .pages .disabled { opacity: .4; }

/* ---------- Forms ---------- */
.form-card { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 12; min-width: 0; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-12 { grid-column: span 12; }
.field label { font-weight: 600; font-size: .86rem; }
.field .req { color: var(--danger); }
.field small.hint { color: var(--muted); font-size: .78rem; }
.field small.err { color: var(--danger); font-size: .8rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); background: var(--surface); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.notice { background: var(--info-soft); color: var(--text); border-left: 4px solid var(--info); padding: 12px 14px; border-radius: 8px; font-size: .88rem; margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.flash-success { background: var(--primary-soft); color: var(--primary-text); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.detail { display: grid; grid-template-columns: 200px 1fr; gap: 0; max-width: 760px; }
.detail dt, .detail dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail dt { color: var(--muted); font-size: .86rem; font-weight: 600; }
.detail dd { white-space: pre-line; }

/* ---------- Calendar ---------- */
.cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal th { text-align: left; padding: 8px 10px; font-size: .74rem; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.cal td { vertical-align: top; height: 112px; padding: 6px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.cal td.off { background: var(--surface-2); opacity: .6; }
.cal td.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal .dn { font-size: .8rem; font-weight: 700; margin-bottom: 4px; }
.cal .ev { display: block; font-size: .72rem; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ev.reminder { background: var(--warn-soft); } .ev.done { background: var(--surface-2); text-decoration: line-through; color: var(--muted); }
.ev.activity { background: var(--info-soft); } .ev.planting { background: var(--primary-soft); }
.ev.harvest-due { background: var(--danger-soft); } .ev.harvest { background: var(--primary-soft); font-weight: 600; }
.cal .ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 14px; }
.cal-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- Reports ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filter-bar .field { grid-column: auto; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.report-title { display: none; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--bg); }
.auth-side { position: relative; background: var(--banner) url('../images/office-records.jpg') center/cover; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
.auth-side::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 38, 37, .96) 8%, rgba(0, 38, 37, .55) 55%, rgba(0, 38, 37, .25)); }
.auth-side > * { position: relative; }
.auth-side h2 { font-size: 1.9rem; margin-bottom: 10px; }
.auth-side p { opacity: .88; max-width: 440px; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px; position: relative; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box .logo { height: 48px; margin-bottom: 26px; }
[data-theme="dark"] .auth-box .logo { background: #fff; padding: 8px 12px; border-radius: 12px; height: 62px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box form { display: grid; gap: 16px; margin-top: 22px; }
.auth-foot { margin-top: 20px; text-align: center; font-size: .9rem; }
.auth-theme { position: absolute; top: 18px; right: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.check input { width: auto; }
.demo-box { margin-top: 22px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; font-size: .82rem; color: var(--muted); }
.demo-box code { color: var(--text); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* ---------- Landing ---------- */
.land-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px 6vw; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.land-nav img { height: 40px; }
[data-theme="dark"] .land-nav .logo-link { background: #fff; padding: 5px 10px; border-radius: 10px; }
.land-nav .right { display: flex; align-items: center; gap: 10px; }
.hero { position: relative; min-height: 80vh; display: flex; align-items: center; padding: 60px 6vw; color: #fff; background: var(--banner) url('../images/sunset-farmer.jpg') center/cover; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(95deg, rgba(0, 38, 37, .96) 25%, rgba(0, 38, 37, .55) 65%, rgba(0, 38, 37, .2)); }
.hero > div { position: relative; max-width: 620px; }
.hero .eyebrow { display: inline-block; padding: 5px 12px; border-radius: 20px; background: rgba(116, 210, 74, .16); color: #9be86e; font-weight: 600; font-size: .82rem; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.1; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: #74d24a; }
.hero p { font-size: 1.1rem; opacity: .9; margin-bottom: 28px; }
.hero .btns { display: flex; gap: 12px; flex-wrap: wrap; }
.section { padding: 72px 6vw; }
.section.alt { background: var(--surface); border-block: 1px solid var(--border); }
.section h2.big { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 10px; }
.section .lead { color: var(--muted); max-width: 640px; margin-bottom: 36px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.feature { padding: 22px; }
.feature .ico { width: 46px; height: 46px; margin-bottom: 14px; border-radius: 12px; display: grid; place-items: center; }
.feature h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .92rem; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.gallery img { width: 100%; height: 240px; object-fit: cover; }
.gallery figcaption { padding: 12px 16px; font-size: .88rem; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.split img { border-radius: var(--radius); width: 100%; height: 380px; object-fit: cover; box-shadow: var(--shadow); }
.checklist { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { color: var(--primary); flex: none; margin-top: 2px; }
.cta { text-align: center; background: var(--banner); color: #fff; border-radius: 24px; padding: 56px 24px; margin: 0 6vw 60px; }
.cta p { opacity: .85; margin: 10px 0 24px; }
.land-foot { text-align: center; padding: 26px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar h1 { font-size: 1.15rem; }
  .org-chip, .top-divider { display: none; }
  .content { padding: 18px 16px 40px; }
  .summary { grid-template-columns: 1fr; }
  .two-col, .split { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .banner { padding: 22px; }
  .banner::after { inset: 0; opacity: .25; -webkit-mask-image: none; mask-image: none; }
  .cal td { height: 84px; }
  .cal .ev { font-size: .66rem; }
  .detail { grid-template-columns: 1fr; } .detail dt { border: 0; padding-bottom: 0; }
}
@media (max-width: 640px) {
  .field, .span-3, .span-4, .span-6 { grid-column: span 12; }
  .stats { grid-template-columns: 1fr; }
}

/* ---------- Print (reports) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .backdrop { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .report-title { display: block; margin-bottom: 14px; }
  .content { padding: 0; }
}

/* keep the period dropdown compact */
.card-head form { flex: none; }
select.select-pill { width: auto; background-color: var(--surface); }

/* ---------- Weather card ---------- */
.weather-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px; }
.weather-now { display: flex; align-items: center; gap: 16px; }
.wx-icon { font-size: 3.2rem; line-height: 1; }
.wx-temp { font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wx-cond { font-weight: 600; }
.wx-meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.weather-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(64px, 1fr)); gap: 8px; flex: 1; max-width: 460px; }
.weather-days li { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; }
.weather-days b { font-size: .78rem; }
.weather-days .wx-ico { font-size: 1.5rem; line-height: 1.3; }
.weather-days .wx-range { font-weight: 600; font-variant-numeric: tabular-nums; }
.weather-days .wx-range small { color: var(--muted); font-weight: 400; }
.weather-days .wx-rain { color: var(--info); font-size: .75rem; }
.weather-tips { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.weather-tips li { padding: 10px 14px; border-radius: var(--radius-sm); font-size: .88rem; border-left: 4px solid var(--border); background: var(--surface-2); }
.weather-tips .tip-good { border-left-color: var(--primary); background: var(--primary-soft); }
.weather-tips .tip-info { border-left-color: var(--info); background: var(--info-soft); }
.weather-tips .tip-warn { border-left-color: var(--warn); background: var(--warn-soft); }
@media (max-width: 640px) {
  .weather-days { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: none; width: 100%; gap: 4px; }
  .weather-days li { padding: 8px 2px; font-size: .72rem; }
  .weather-days .wx-rain { font-size: .68rem; }
}

/* ---------- Critical alerts (admin) ---------- */
:root { --alert: #d92d20; --alert-hover: #b42318; --alert-soft: #fef0ee; --alert-border: #f6b8b1; }
[data-theme="dark"] { --alert: #ff6b5e; --alert-hover: #ff8a80; --alert-soft: rgba(217, 45, 32, .18); --alert-border: rgba(255, 107, 94, .45); }

.btn-alert { background: var(--alert); color: #fff; }
.btn-alert:hover { background: var(--alert-hover); color: #fff; }
.badge-alert { background: var(--alert); color: #fff; }

.alert-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px;
  background: var(--alert-soft); color: var(--text); border: 1px solid var(--alert-border);
  border-left: 6px solid var(--alert); border-radius: var(--radius-sm);
}
.alert-banner .alert-ico { color: var(--alert); display: grid; place-items: center; flex: none; }
.alert-banner .alert-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.alert-banner .alert-text strong { color: var(--alert); font-size: 1rem; }
.alert-banner .alert-text span { font-size: .88rem; }
.alert-banner form { margin: 0; flex: none; }
.alert-banner.is-resolved { background: var(--surface-2); border-color: var(--border); border-left-color: var(--muted); }
.alert-banner.is-resolved .alert-ico, .alert-banner.is-resolved .alert-text strong { color: var(--muted); }

.alert-btn { color: var(--alert); animation: alert-pulse 2s ease-in-out infinite; }
.alert-btn:hover { color: var(--alert-hover); background: var(--alert-soft); }
@keyframes alert-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 45, 32, .45); } 50% { box-shadow: 0 0 0 7px rgba(217, 45, 32, 0); } }
@media (prefers-reduced-motion: reduce) { .alert-btn { animation: none; } }

.nav-alert {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--alert); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}

.alert-card { border: 1px solid var(--alert-border); border-top: 4px solid var(--alert); background: var(--alert-soft); }
.alert-card .card-head h2 { color: var(--alert); display: flex; align-items: center; gap: 8px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.alert-list li {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--alert-border); border-radius: var(--radius-sm);
}
.alert-list .grow { flex: 1; min-width: 220px; }
.alert-list .t { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-list .s { font-size: .84rem; color: var(--muted); margin-top: 2px; }
.alert-actions { display: flex; gap: 8px; align-items: center; }
.alert-actions form { margin: 0; }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: .88rem; text-decoration: none;
}
.filter-tabs a:hover { background: var(--surface-2); text-decoration: none; }
.filter-tabs a.active { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.filter-tabs a.is-critical .count { background: var(--alert); color: #fff; }
.filter-tabs a.is-critical.active { background: var(--alert-soft); color: var(--alert); border-color: var(--alert-border); }
.filter-tabs .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--border); font-size: .72rem; display: grid; place-items: center; }

.table tbody tr.row-critical { background: var(--alert-soft); box-shadow: inset 4px 0 0 var(--alert); }
.table tbody tr.row-critical:hover { background: var(--alert-soft); filter: brightness(.98); }
@media (max-width: 640px) { .alert-banner { flex-wrap: wrap; } }
