:root {
  --bg: #F7F8F3;
  --surface: #ffffff;
  --surface-soft: #f1f4ee;
  --text: #1E2A22;
  --muted: #66736B;
  --line: #d9e0d8;
  --brand: #2F6B45;
  --brand-dark: #214F35;
  --brand-deep: #153b27;
  --brand-soft: #e8f2eb;
  --pepper: #D9543D;
  --irrigation: #2F80ED;
  --warning: #D99614;
  --danger: #C23B34;
  --purple: #7556a6;
  --shadow: 0 12px 32px rgba(30, 42, 34, .09);
  --shadow-soft: 0 4px 14px rgba(30, 42, 34, .06);
  --topbar-height: 62px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100%; color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(47, 128, 237, .38); outline-offset: 2px; }
#main-content:focus { outline: none; }
.skip-link { position: fixed; z-index: 1000; left: 14px; top: -80px; padding: 10px 14px; border-radius: 9px; color: #fff; background: var(--brand-deep); transition: top .15s; }
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 250px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 18px 14px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 7%, rgba(255,255,255,.13), transparent 25%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, #1e5837, #143e28 60%, #102f20);
  box-shadow: 8px 0 28px rgba(21, 59, 39, .18);
}
.brand { min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 11px; padding: 10px 8px 16px; }
.brand-mark { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.38); border-radius: 15px; background: rgba(255,255,255,.12); box-shadow: 0 9px 18px rgba(0,0,0,.18); font-size: 27px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 22px; line-height: 1; letter-spacing: -.035em; }
.brand-copy small { margin-top: 5px; color: rgba(255,255,255,.72); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.main-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  min-height: 51px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 14px;
  color: #fff;
  background: rgba(255,255,255,.065);
  box-shadow: 0 6px 15px rgba(0,0,0,.08);
  font-size: 13px;
  font-weight: 800;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.nav-link:hover { transform: translateY(-1px); background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.48); }
.nav-link.active { color: var(--text); background: linear-gradient(135deg, #fff, #edf7ef); border-color: #e4b49f; box-shadow: 0 0 0 2px rgba(217,84,61,.26), 0 9px 20px rgba(0,0,0,.16); }
.nav-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.12); font-size: 17px; font-weight: 900; }
.nav-link.active .nav-icon { color: var(--brand-dark); background: var(--brand-soft); }
.nav-arrow { width: 22px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.09); font-size: 20px; }
.nav-link.active .nav-arrow { color: var(--pepper); background: #faece8; }
.nav-link-admin { margin-top: 6px; background: rgba(0,0,0,.12); }
.sidebar-status { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 13px; background: rgba(0,0,0,.12); }
.sidebar-status > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.sidebar-status strong { font-size: 12px; }
.sidebar-status small { color: rgba(255,255,255,.65); font-size: 10px; }
.status-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #58d78b; box-shadow: 0 0 0 4px rgba(88,215,139,.15); }

.main-column { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand) 55%, #347a4f);
  box-shadow: 0 4px 16px rgba(33,79,53,.2);
}
.topbar-start, .topbar-actions { display: flex; align-items: center; gap: 9px; }
.menu-button { display: none !important; }
.icon-button { position: relative; min-width: 40px; height: 40px; display: grid; place-items: center; padding: 0 10px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; color: #fff; background: rgba(255,255,255,.11); font-weight: 800; }
.icon-button:hover { background: rgba(255,255,255,.2); }
.farm-context { display: grid; grid-template-columns: 30px minmax(0,1fr) 18px; align-items: center; gap: 8px; min-width: 220px; height: 46px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.32); border-radius: 12px; color: #fff; background: rgba(255,255,255,.1); text-align: left; }
.farm-context-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.13); }
.farm-context-copy { display: flex; min-width: 0; flex-direction: column; }
.farm-context-copy small { color: rgba(255,255,255,.72); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.farm-context-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.context-menu { position: absolute; top: calc(100% + 8px); left: 20px; z-index: 55; width: min(330px, calc(100vw - 28px)); padding: 6px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #fff; box-shadow: var(--shadow); }
.context-menu button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 11px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.context-menu button:hover, .context-menu button[aria-selected="true"] { background: var(--brand-soft); }
.context-menu small { color: var(--muted); }
.connection-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: rgba(255,255,255,.86); font-size: 11px; font-weight: 700; }
.connection-chip span { color: #74eba2; }
.top-register-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.42); border-radius: 10px; color: #fff; background: var(--pepper); font-weight: 850; }
.top-register-button:hover { background: #c74832; }
.notification-button .badge { position: absolute; right: -5px; top: -6px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; color: #fff; background: var(--pepper); font-size: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; height: 44px; padding: 5px 9px; border: 0; border-radius: 11px; color: var(--text); background: rgba(255,255,255,.97); box-shadow: 0 4px 12px rgba(21,59,39,.18); text-align: left; }
.avatar, .person-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); font-size: 11px; font-weight: 850; }
.user-chip > span:last-child { display: flex; flex-direction: column; }
.user-chip strong { font-size: 11px; }
.user-chip small { color: var(--muted); font-size: 9px; }

.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px; }
.screen { display: none; }
.screen.active { display: block; animation: screen-in .17s ease-out; }
@keyframes screen-in { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.eyebrow, .card-kicker { color: var(--brand); font-size: 10px; font-weight: 900; letter-spacing: .085em; text-transform: uppercase; }
.home-head, .module-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.home-head h1, .module-head h1 { margin: 1px 0 4px; font-size: clamp(25px, 3vw, 34px); line-height: 1.08; letter-spacing: -.035em; }
.home-head p, .module-head p { margin: 0; color: var(--muted); font-size: 13px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; color: #fff; background: var(--brand); font-weight: 800; }
.button:hover { background: var(--brand-dark); }
.button.secondary { color: var(--text); border-color: var(--line); background: #fff; }
.button.secondary:hover { background: var(--surface-soft); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.mini-button, .text-button { border: 0; color: var(--brand); background: transparent; font-size: 12px; font-weight: 800; }
.mini-button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.quick-action-strip { position: sticky; top: calc(var(--topbar-height) + 1px); z-index: 12; display: flex; gap: 8px; margin: 0 -2px 12px; padding: 4px 2px 8px; overflow-x: auto; background: linear-gradient(180deg, rgba(247,248,243,.98) 72%, rgba(247,248,243,0)); scrollbar-width: thin; }
.quick-action { min-width: 170px; display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #fff; box-shadow: var(--shadow-soft); text-align: left; }
.quick-action > span:first-child { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; font-size: 18px; }
.quick-action > span:last-child { display: flex; flex-direction: column; }
.quick-action strong { font-size: 12px; }
.quick-action small { color: var(--muted); font-size: 9px; }
.quick-action.irrigation > span:first-child { color: #fff; background: var(--irrigation); }
.quick-action.treatment > span:first-child { color: #fff; background: var(--purple); }
.quick-action.production > span:first-child { background: #e6f3e9; }
.quick-action.expense > span:first-child { color: #fff; background: var(--pepper); }
.quick-action.note > span:first-child { background: #fff3cf; }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(280px, .8fr); gap: 12px; align-items: stretch; }
.card, .tab-panel, .calendar-panel { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-soft); }
.card { min-width: 0; padding: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 1px 0 0; font-size: 18px; }
.weather-card { background: linear-gradient(145deg, #eef8ff, #fff); border-color: #cfe0ef; }
.weather-icon { font-size: 38px; }
.weather-main { display: flex; align-items: center; gap: 15px; padding: 14px 0; }
.weather-main > strong { font-size: 48px; line-height: 1; letter-spacing: -.06em; }
.weather-main > span { color: var(--muted); font-size: 12px; }
.weather-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.weather-row span { display: flex; flex-direction: column; padding: 7px; border-radius: 9px; background: rgba(255,255,255,.76); color: var(--muted); font-size: 9px; }
.weather-row b { color: var(--text); font-size: 12px; }
.timeline-list, .alert-list { display: grid; gap: 6px; margin-top: 10px; }
.timeline-item, .alert-list > button { width: 100%; display: grid; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: #f8faf7; text-align: left; }
.timeline-item { grid-template-columns: 43px 5px minmax(0,1fr) 14px; padding: 8px; }
.timeline-time { color: var(--muted); font-size: 10px; font-weight: 800; }
.timeline-mark { width: 5px; height: 32px; border-radius: 99px; }
.timeline-mark.irrigation, .event-line.irrigation { background: var(--irrigation); }
.timeline-mark.treatment, .event-line.treatment { background: var(--purple); }
.timeline-mark.production, .event-line.production { background: var(--brand); }
.timeline-item span:nth-child(3), .alert-list > button span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.timeline-item strong, .alert-list strong { font-size: 11px; }
.timeline-item small, .alert-list small { color: var(--muted); font-size: 9px; }
.count-badge { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; color: #fff; background: var(--pepper); font-size: 11px; font-weight: 850; }
.alert-list > button { grid-template-columns: 30px minmax(0,1fr) auto; padding: 8px; }
.alert-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #fff; font-weight: 900; }
.alert-icon.warning { background: var(--warning); }
.alert-icon.danger { background: var(--danger); }
.alert-icon.info { background: var(--irrigation); }
.compact-summary-card { grid-column: 1 / -1; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin-top: 10px; }
.summary-grid article { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fafcf9; }
.summary-grid article > span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.summary-grid article > strong { display: block; margin: 3px 0; font-size: 19px; }
.summary-grid article > small { color: var(--muted); font-size: 9px; }

.module-head { align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 16px; background: linear-gradient(135deg, #f7fbf8, #fff); box-shadow: var(--shadow-soft); }
.module-head.inventory { border-left-color: var(--warning); }
.module-head.operation { border-left-color: var(--pepper); }
.module-head.workforce { border-left-color: var(--irrigation); }
.module-head.community { border-left-color: var(--purple); }
.module-head.reports { border-left-color: #4d728f; }
.module-head.admin { border-left-color: #4b5563; }
.module-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.module-icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--brand); box-shadow: 0 7px 15px rgba(47,107,69,.18); font-size: 23px; font-weight: 900; }
.module-head.inventory .module-icon { background: var(--warning); }
.module-head.operation .module-icon { background: var(--pepper); }
.module-head.workforce .module-icon { background: var(--irrigation); }
.module-head.community .module-icon { background: var(--purple); }
.module-head.reports .module-icon { background: #4d728f; }
.module-head.admin .module-icon { background: #4b5563; }
.module-head h1 { font-size: clamp(22px, 2.6vw, 30px); }

.module-tabs { position: sticky; top: calc(var(--topbar-height) + 2px); z-index: 11; display: flex; gap: 7px; margin: 0 -2px 8px; padding: 4px 2px 7px; overflow-x: auto; background: linear-gradient(180deg, rgba(247,248,243,.98) 72%, rgba(247,248,243,0)); scroll-snap-type: x proximity; scrollbar-width: thin; }
.module-tab { --tab-accent: var(--brand); min-width: max-content; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; gap: 0 7px; padding: 8px 11px; border: 1px solid color-mix(in srgb, var(--tab-accent) 24%, var(--line)); border-radius: 11px; color: var(--text); background: #fff; box-shadow: 0 2px 7px rgba(30,42,34,.035); text-align: left; scroll-snap-align: start; }
.module-tab > span { grid-row: 1 / 3; font-size: 17px; }
.module-tab strong { color: var(--tab-accent); font-size: 11px; letter-spacing: .02em; }
.module-tab small { color: var(--muted); font-size: 8px; }
.module-tab:hover { transform: translateY(-1px); }
.module-tab.active { background: var(--brand-soft); border-color: var(--tab-accent); box-shadow: inset 0 -3px var(--tab-accent), 0 5px 13px rgba(30,42,34,.08); }
.module-tab.active strong { font-weight: 950; }
.tab-stage { min-height: 240px; }
.tab-panel { padding: 13px; background: linear-gradient(155deg, var(--brand-soft), #fff 170px); }
.tab-panel.active { animation: panel-in .16s ease-out; }
@keyframes panel-in { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.panel-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.panel-toolbar h2 { margin: 0; font-size: 18px; }
.panel-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.toolbar-controls { display: flex; align-items: center; gap: 7px; }
.toolbar-controls input, .form-grid input, .form-grid select, .report-builder select { min-height: 36px; padding: 7px 9px; border: 1px solid #bfcac0; border-radius: 9px; background: #fff; }

.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.entity-card { display: grid; grid-template-columns: 90px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.entity-card.selected { border-color: #95b9a0; box-shadow: inset 4px 0 var(--brand); }
.entity-visual { height: 78px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #6ea57e, #2f6b45); font-size: 34px; }
.entity-visual.greenhouse { background: linear-gradient(145deg, #87a8ba, #4d728f); }
.entity-copy h2 { margin: 4px 0 2px; font-size: 16px; }
.entity-copy p { margin: 0; color: var(--muted); font-size: 10px; }
.entity-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 9px; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 999px; color: #45534a; background: #edf0ec; font-size: 9px; font-weight: 800; }
.pill.active { color: #155d36; background: #e5f5ea; }
.pill.warning { color: #785000; background: #fff2c7; }
.compact-list, .document-list, .movement-list, .production-list { display: grid; gap: 6px; }
.compact-list > button, .document-list > button, .movement-list > article, .production-list > article { display: grid; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.compact-list > button { grid-template-columns: 32px minmax(0,1fr) auto 14px; text-align: left; }
.compact-list > button > span:nth-child(2), .document-list > button > span:nth-child(2), .movement-list > article > span:nth-child(2), .production-list > article > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.compact-list strong, .document-list strong, .movement-list strong, .production-list strong { font-size: 11px; }
.compact-list small, .document-list small, .movement-list small, .production-list small { color: var(--muted); font-size: 9px; }
.sector-swatch { width: 28px; height: 28px; display: block; border-radius: 9px; background: var(--pepper); }
.sector-swatch.yellow { background: var(--warning); }
.campaign-grid, .chip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 9px; }
.campaign-grid article, .chip-grid > button { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.campaign-grid h3 { margin: 6px 0 2px; }
.campaign-grid p { margin: 0 0 8px; color: var(--muted); font-size: 10px; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e7ebe6; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.chip-grid > button { display: grid; grid-template-columns: 38px minmax(0,1fr); grid-template-rows: auto auto; align-items: center; gap: 0 9px; }
.chip-grid > button > span { grid-row: 1 / 3; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); font-size: 20px; }
.chip-grid strong { font-size: 12px; }
.chip-grid small { color: var(--muted); font-size: 9px; }
.map-placeholder, .form-placeholder { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px; border: 1px dashed #9fb6a5; border-radius: 13px; background: linear-gradient(135deg, #edf5ee, #fff); text-align: center; }
.map-placeholder .map-pin, .form-placeholder > span { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: var(--brand); font-size: 30px; }
.map-placeholder strong, .form-placeholder h2 { margin: 0; font-size: 20px; }
.map-placeholder > span, .form-placeholder p { max-width: 540px; margin: 0; color: var(--muted); font-size: 11px; }
.document-list > button { grid-template-columns: 42px minmax(0,1fr) 15px; text-align: left; }
.file-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--pepper); font-size: 9px; font-weight: 900; }
.file-icon.image { background: var(--irrigation); }

.calendar-screen.active { height: calc(100dvh - var(--topbar-height) - 44px); min-height: 620px; display: flex; flex-direction: column; overflow: hidden; }
.calendar-head { flex: none; min-height: 66px; margin-bottom: 8px; padding-top: 9px; padding-bottom: 9px; }
.calendar-head .module-icon { width: 45px; height: 45px; }
.calendar-head h1 { font-size: 24px; }
.calendar-view-tabs { display: none; }
.calendar-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(310px, .72fr); gap: 9px; }
.calendar-panel { min-height: 0; overflow: hidden; background: #fff; }
.calendar-month-panel { height: 100%; display: flex; flex-direction: column; }
.calendar-toolbar, .side-panel-head { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; align-items: center; gap: 7px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f4f9f5, #fff); }
.calendar-toolbar > button, .side-panel-head > button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--brand); background: #fff; font-size: 22px; }
.calendar-toolbar div, .side-panel-head div { text-align: center; }
.calendar-toolbar h2, .side-panel-head h2 { margin: 0; font-size: 16px; }
.calendar-toolbar .text-button { padding: 0; font-size: 9px; }
.calendar-weekdays { flex: none; display: grid; grid-template-columns: repeat(7, 1fr); padding: 5px 6px 3px; }
.calendar-weekdays span { text-align: center; color: var(--muted); font-size: 9px; font-weight: 800; }
.calendar-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, minmax(0,1fr)); gap: 3px; padding: 5px; }
.calendar-day { position: relative; min-height: 0; padding: 5px; border: 1px solid #e2e7e1; border-radius: 9px; background: #fff; text-align: left; }
.calendar-day:hover { border-color: #8ab29a; background: #f7fbf8; }
.calendar-day.outside { opacity: .45; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.calendar-day.selected { background: var(--brand-soft); }
.calendar-number { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 10px; font-weight: 850; }
.calendar-day.today .calendar-number { color: #fff; background: var(--brand); }
.calendar-markers { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.event-dot { width: 6px; height: 6px; border-radius: 50%; }
.event-dot.irrigation { background: var(--irrigation); }
.event-dot.treatment { background: var(--purple); }
.event-dot.production { background: var(--brand); }
.calendar-chip { padding: 1px 4px; border-radius: 999px; color: var(--brand-dark); background: #e4f1e8; font-size: 8px; font-weight: 850; }
.calendar-side { min-height: 0; display: grid; grid-template-rows: minmax(145px, .38fr) minmax(0, .62fr); gap: 9px; }
.week-panel { display: flex; flex-direction: column; }
.side-panel-head { grid-template-columns: 30px minmax(0,1fr) 30px; padding: 7px 8px; }
.side-panel-head > button { width: 29px; height: 29px; }
.side-panel-head h2 { font-size: 13px; }
.side-panel-head p { margin: 1px 0 0; color: var(--muted); font-size: 8px; }
.week-chart { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7,1fr); align-items: end; gap: 5px; padding: 9px 8px; }
.week-chart > div { height: 100%; display: grid; grid-template-rows: 16px 1fr 14px; align-items: end; justify-items: center; gap: 2px; }
.week-chart span { font-size: 8px; }
.week-chart i { width: min(27px, 76%); display: block; align-self: end; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #74ad85, var(--brand)); }
.week-chart b { font-size: 9px; }
.day-panel, .agenda-panel { display: flex; flex-direction: column; gap: 7px; padding: 10px; }
.selected-day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.selected-day-head span { color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.selected-day-head h2 { margin: 1px 0 0; font-size: 17px; }
.selected-day-head > strong { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--brand); }
.day-events, .agenda-list { min-height: 0; display: grid; align-content: start; gap: 5px; overflow-y: auto; }
.day-events button { display: grid; grid-template-columns: 4px minmax(0,1fr) 14px; align-items: center; gap: 8px; padding: 7px; border: 0; border-radius: 8px; background: #f8faf7; text-align: left; }
.event-line { width: 4px; height: 34px; border-radius: 99px; }
.day-events span:nth-child(2) { display: flex; flex-direction: column; }
.day-events strong { font-size: 10px; }
.day-events small { color: var(--muted); font-size: 8px; }
.quick-detail { margin-top: auto; border: 1px solid #cfe0d3; border-radius: 10px; overflow: hidden; }
.quick-detail summary { list-style: none; display: grid; grid-template-columns: minmax(0,1fr) auto 16px; align-items: center; gap: 7px; min-height: 38px; padding: 7px 9px; background: linear-gradient(135deg, #eef7f0, #fff); cursor: pointer; }
.quick-detail summary::-webkit-details-marker { display: none; }
.quick-detail summary span { color: var(--brand); font-size: 10px; font-weight: 850; }
.quick-detail summary strong { color: var(--muted); font-size: 8px; }
.quick-detail summary i { font-style: normal; }
.detail-body { display: grid; gap: 7px; padding: 8px; border-top: 1px solid var(--line); }
.detail-body label { display: grid; gap: 4px; font-size: 9px; font-weight: 800; }
.detail-body textarea { width: 100%; padding: 7px; border: 1px solid #bbc8bd; border-radius: 8px; resize: vertical; }
.agenda-list button { display: grid; grid-template-columns: 47px minmax(0,1fr) 14px; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: 9px; background: #f8faf7; text-align: left; }
.agenda-list time { color: var(--brand); font-size: 9px; font-weight: 900; }
.agenda-list span:nth-child(2) { display: flex; flex-direction: column; }
.agenda-list strong { font-size: 10px; }
.agenda-list small { color: var(--muted); font-size: 8px; }

.product-grid, .people-grid, .service-grid, .market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 9px; }
.product-card, .people-grid article, .service-grid article, .market-grid article { position: relative; display: grid; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.product-card { grid-template-columns: 56px minmax(0,1fr) auto; }
.product-thumb { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--irrigation); font-weight: 900; }
.product-thumb.green { background: var(--brand); }
.product-thumb.amber { background: var(--warning); }
.product-card h3, .people-grid h3, .service-grid h3, .market-grid h3 { margin: 3px 0 1px; font-size: 13px; }
.product-card p, .people-grid p, .service-grid p, .market-grid p { margin: 0; color: var(--muted); font-size: 9px; }
.product-card > div:nth-child(2) > strong { display: block; margin-top: 5px; }
.inventory-summary { margin: 0; }
.movement-list > article { grid-template-columns: 34px minmax(0,1fr) auto; }
.movement-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: #fff; font-weight: 900; }
.movement-icon.out { background: var(--pepper); }
.movement-icon.in { background: var(--brand); }
.movement-icon.transfer { background: var(--irrigation); }
.alert-list.large > button { min-height: 58px; padding: 10px; border: 1px solid var(--line); background: #fff; }
.production-list > article { grid-template-columns: 50px minmax(0,1fr) auto 16px; }
.production-list time { color: var(--brand); font-size: 9px; font-weight: 900; text-align: center; }
.production-list b { color: var(--brand-dark); font-size: 13px; }
.profit-panel { display: grid; grid-template-columns: minmax(240px,.75fr) minmax(0,1.25fr); gap: 12px; }
.profit-main { display: flex; flex-direction: column; justify-content: center; padding: 18px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, var(--brand), var(--brand-dark)); }
.profit-main > span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.profit-main > strong { margin: 5px 0; font-size: 30px; }
.profit-main > small { color: rgba(255,255,255,.76); font-size: 9px; }
.profit-bars { display: grid; align-content: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.profit-bars > div { display: grid; grid-template-columns: 70px minmax(0,1fr) 80px; align-items: center; gap: 8px; font-size: 10px; }
.profit-bars i { height: 9px; overflow: hidden; border-radius: 99px; background: #e7ebe6; }
.profit-bars b { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

.people-grid article { grid-template-columns: 42px minmax(0,1fr) auto; }
.person-avatar { width: 40px; height: 40px; }
.person-avatar.small { width: 32px; height: 32px; }
.timeclock-layout { display: grid; grid-template-columns: minmax(260px,.7fr) minmax(0,1.3fr); gap: 10px; }
.kiosk-card { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; border: 1px solid #cbdced; border-radius: 13px; background: linear-gradient(145deg, #eef7ff, #fff); text-align: center; }
.kiosk-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; color: #fff; background: var(--irrigation); font-size: 31px; }
.kiosk-card h2 { margin: 9px 0 2px; }
.kiosk-card p { max-width: 320px; margin: 0 0 12px; color: var(--muted); font-size: 10px; }
.attendance-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.attendance-card header { display: flex; align-items: center; justify-content: space-between; }
.attendance-card header span { color: var(--muted); font-size: 9px; }
.attendance-card h2 { margin: 1px 0; font-size: 17px; }
.attendance-card header > strong { font-size: 24px; }
.attendance-card p { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 8px; margin: 6px 0; padding: 8px; border-radius: 9px; background: #f8faf7; font-size: 11px; }
.status-dot.paused { background: var(--warning); box-shadow: 0 0 0 4px rgba(217,150,20,.15); }
.status-dot.off { background: #9aa39c; box-shadow: 0 0 0 4px rgba(154,163,156,.15); }

.service-grid article, .market-grid article { display: block; }
.sponsor-label { position: absolute; right: 8px; top: 8px; padding: 3px 7px; border-radius: 999px; color: #73500c; background: #fff1bf; font-size: 8px; font-weight: 850; }
.service-logo { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--purple); font-weight: 900; }
.service-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-top: 10px; }
.service-actions button { padding: 7px 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 9px; font-weight: 800; }
.forum-list { display: grid; gap: 9px; }
.forum-list article { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.forum-list header { display: flex; align-items: center; gap: 8px; }
.forum-list header > div { display: flex; flex-direction: column; }
.forum-list header strong { font-size: 11px; }
.forum-list header small { color: var(--muted); font-size: 8px; }
.forum-list h3 { margin: 10px 0 3px; font-size: 14px; }
.forum-list p { margin: 0; color: var(--muted); font-size: 10px; }
.forum-list footer { display: flex; gap: 6px; margin-top: 10px; }
.forum-list footer button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 9px; }
.market-image { height: 100px; display: grid; place-items: center; margin-bottom: 9px; border-radius: 11px; background: linear-gradient(145deg, #edf3ed, #fafcf9); font-size: 42px; }
.market-grid > article > strong { display: block; margin-top: 7px; }
.chat-preview { min-height: 430px; display: grid; grid-template-columns: 270px minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.chat-preview aside { border-right: 1px solid var(--line); }
.chat-preview aside button { width: 100%; display: grid; grid-template-columns: 32px minmax(0,1fr) 22px; align-items: center; gap: 7px; padding: 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.chat-preview aside button.active { background: var(--brand-soft); }
.chat-preview aside span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.chat-preview aside strong { font-size: 10px; }
.chat-preview aside small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview aside b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 999px; color: #fff; background: var(--pepper); font-size: 8px; }
.chat-preview > section { min-width: 0; display: flex; flex-direction: column; }
.chat-preview > section > header { display: flex; flex-direction: column; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-preview > section > header strong { font-size: 11px; }
.chat-preview > section > header small { color: var(--muted); font-size: 8px; }
.messages { flex: 1; padding: 12px; overflow-y: auto; background: #f5f3ee; }
.messages p { width: fit-content; max-width: 78%; margin: 6px auto 6px 0; padding: 8px 10px; border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-size: 10px; }
.messages p.mine { margin-left: auto; margin-right: 0; background: #e4f1e8; }
.chat-preview form { display: flex; gap: 6px; padding: 9px; border-top: 1px solid var(--line); }
.chat-preview form input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid #bdc8be; border-radius: 9px; }

.report-builder { display: grid; grid-template-columns: minmax(0,1fr) 230px; gap: 12px; }
.report-builder h2 { margin: 0; }
.report-builder p { margin: 3px 0 12px; color: var(--muted); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 10px; font-weight: 800; }
.report-builder aside { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 220px; padding: 16px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #4d728f, #315169); text-align: center; }
.report-builder aside span { font-size: 9px; letter-spacing: .08em; }
.report-builder aside strong { margin: 4px 0; font-size: 44px; }
.report-builder aside p { margin: 0; color: #fff; }
.report-builder aside small { margin-top: 7px; color: rgba(255,255,255,.72); }
.health-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.health-grid article { display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.health-status { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; font-weight: 900; }
.health-status.ok { background: var(--brand); }
.health-status.warning { background: var(--warning); }
.health-grid article div { display: flex; flex-direction: column; }
.health-grid strong { font-size: 11px; }
.health-grid small { color: var(--muted); font-size: 9px; }

.mobile-overlay { display: none; }
.mobile-register-fab { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(17, 31, 22, .5); backdrop-filter: blur(2px); }
.register-sheet { position: fixed; left: 50%; bottom: 18px; z-index: 80; width: min(720px, calc(100vw - 28px)); transform: translateX(-50%); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(17,31,22,.28); }
.register-sheet > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 17px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #edf7ef, #fff); }
.register-sheet h2 { margin: 1px 0 2px; font-size: 21px; }
.register-sheet p { margin: 0; color: var(--muted); font-size: 10px; }
.register-sheet .icon-button { color: var(--text); border-color: var(--line); background: #fff; }
.register-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 12px; }
.register-grid > button { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 9px; min-height: 70px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.register-grid > button:hover { border-color: #8bb49a; background: #f7fbf8; }
.register-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: #fff; font-size: 18px; font-weight: 900; }
.register-icon.irrigation { background: var(--irrigation); }
.register-icon.treatment { background: var(--purple); }
.register-icon.activity { background: var(--brand); }
.register-icon.production { color: var(--brand-dark); background: var(--brand-soft); }
.register-icon.expense { background: var(--pepper); }
.register-icon.note { color: #76520a; background: #fff0bd; }
.register-grid > button > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.register-grid strong { font-size: 11px; }
.register-grid small { color: var(--muted); font-size: 8px; }
.register-sheet footer { padding: 9px 14px; color: var(--muted); background: #fafcf9; font-size: 9px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 100; transform: translateX(-50%); max-width: min(520px, calc(100vw - 28px)); padding: 10px 14px; border-radius: 11px; color: #fff; background: #1f2f25; box-shadow: var(--shadow); font-size: 12px; font-weight: 700; text-align: center; }

body.simple-mode { font-size: 18px; }
body.simple-mode .nav-link { min-height: 58px; font-size: 15px; }
body.simple-mode .module-tab small, body.simple-mode .quick-action small, body.simple-mode .card-kicker { display: none; }
body.simple-mode .module-tab { min-height: 55px; }
body.simple-mode .timeline-item strong, body.simple-mode .alert-list strong, body.simple-mode .product-card h3, body.simple-mode .people-grid h3 { font-size: 14px; }
body.simple-mode .dashboard-layout { grid-template-columns: 1fr 1fr; }
body.simple-mode .alert-card { grid-column: 1 / -1; }

@media (max-width: 1180px) {
  .dashboard-layout { grid-template-columns: 1fr 1fr; }
  .alert-card { grid-column: 1 / -1; }
  .compact-summary-card { grid-column: 1 / -1; }
  .entity-grid { grid-template-columns: 1fr; }
  .connection-chip { display: none; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -272px; width: 250px; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .mobile-overlay.open { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(0,0,0,.42); }
  .menu-button { display: grid !important; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .calendar-screen.active { height: calc(100dvh - var(--topbar-height) - 32px); }
  .calendar-workspace { grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); }
  .top-register-button { display: none; }
  .mobile-register-fab { position: fixed; right: 17px; bottom: 17px; z-index: 45; width: 54px; height: 54px; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: var(--pepper); box-shadow: 0 10px 25px rgba(194,59,52,.3); font-size: 26px; }
}

@media (max-width: 820px) {
  .calendar-screen.active { min-height: 0; }
  .calendar-head { min-height: 54px; }
  .calendar-head p, .calendar-head .eyebrow { display: none; }
  .calendar-head h1 { font-size: 20px; }
  .calendar-head .button { min-height: 32px; padding: 5px 8px; font-size: 10px; }
  .calendar-view-tabs { flex: none; display: flex; gap: 4px; margin-bottom: 6px; padding: 3px; border: 1px solid #c9d7cc; border-radius: 11px; background: #edf5ef; }
  .calendar-view-tab { flex: 1; min-width: 0; padding: 6px 5px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 850; white-space: nowrap; }
  .calendar-view-tab.active { color: #fff; background: var(--brand); box-shadow: 0 3px 8px rgba(47,107,69,.18); }
  .calendar-workspace { display: block; flex: 1; min-height: 0; }
  .calendar-side { display: contents; }
  .calendar-panel { height: 100%; }
  .calendar-panel:not(.active), .calendar-panel[hidden] { display: none !important; }
  .calendar-month-panel.active { display: flex; }
  .day-panel.active, .agenda-panel.active { display: flex; }
  .week-panel.active { display: flex; }
  .profit-panel, .timeclock-layout, .report-builder { grid-template-columns: 1fr; }
  .chat-preview { grid-template-columns: 1fr; }
  .chat-preview aside { display: none; }
}

@media (max-width: 720px) {
  :root { --topbar-height: 56px; }
  .topbar { height: var(--topbar-height); padding: 0 8px; }
  .farm-context { min-width: 0; width: min(210px, calc(100vw - 215px)); height: 42px; }
  .farm-context-icon { display: none; }
  .farm-context { grid-template-columns: minmax(0,1fr) 14px; }
  .topbar-actions .icon-button[data-simple-mode] { display: none; }
  .top-register-button { width: 40px; height: 40px; min-height: 40px; display: grid; flex: none; place-items: center; padding: 0; border-radius: 10px; font-size: 0; }
  .top-register-button span { font-size: 22px; line-height: 1; }
  .mobile-register-fab { display: none; }
  .user-chip { height: 40px; padding: 4px 6px; }
  .user-chip > span:last-child { display: none; }
  .content { padding: 10px 8px 74px; }
  .home-head, .module-head { gap: 8px; }
  .home-head h1 { font-size: 24px; }
  .module-head { align-items: flex-start; padding: 10px 11px; }
  .module-head p { display: none; }
  .module-icon { width: 41px; height: 41px; border-radius: 12px; font-size: 19px; }
  .module-head h1 { font-size: 20px; }
  .module-head > .button { min-height: 32px; padding: 5px 8px; font-size: 10px; }
  .module-tabs { top: calc(var(--topbar-height) + 1px); margin-bottom: 7px; }
  .module-tab { padding: 7px 9px; }
  .module-tab strong { font-size: 10px; }
  .module-tab small { font-size: 7px; }
  .tab-panel { padding: 9px; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .alert-card, .compact-summary-card { grid-column: auto; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .panel-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-controls { width: 100%; }
  .toolbar-controls input { min-width: 0; flex: 1; }
  .entity-card { grid-template-columns: 64px minmax(0,1fr); }
  .entity-card > .button { grid-column: 1 / -1; }
  .entity-visual { height: 62px; }
  .product-grid, .people-grid, .service-grid, .market-grid { grid-template-columns: 1fr; }
  .calendar-screen.active { height: calc(100dvh - var(--topbar-height) - 18px); padding-bottom: 0; }
  .register-sheet { bottom: 0; width: 100%; border-radius: 18px 18px 0 0; }
  .register-grid { grid-template-columns: 1fr 1fr; }
  .health-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .farm-context { width: calc(100vw - 215px); padding-left: 7px; }
  .farm-context-copy small { display: none; }
  .topbar-actions { gap: 5px; }
  .topbar .notification-button { display: none; }
  .home-head .button { display: none; }
  .quick-action { min-width: 145px; }
  .weather-main > strong { font-size: 42px; }
  .weather-row { grid-template-columns: 1fr 1fr 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .module-head .eyebrow { display: none; }
  .module-tab > span { font-size: 16px; }
  .entity-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .register-grid { grid-template-columns: 1fr; max-height: 58dvh; overflow-y: auto; }
}
