@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap");

/*
 * Fieldnote design system
 *
 * Layout contracts:
 * - Desktop navigation is 245px expanded and 72px collapsed.
 * - The status header and page canvas always occupy the remaining viewport.
 * - Full-screen chat shares the viewport with navigation.
 * - Conversation history is a true adjacent column, not an overlay on desktop.
 */
:root {
  --ink: #20352c;
  --muted: #687a71;
  --cream: #f5f3eb;
  --paper: #fffdf8;
  --moss: #597466;
  --deep: #304c40;
  --sage: #dfe9dc;
  --clay: #ad674b;
  --line: #dce3da;
  --yellow: #eadf9b;
  --sidebar: #29453b;
  --sidebar-hover: #416355;
  --sidebar-width: 245px;
  --sidebar-collapsed-width: 72px;
  --content-max: 1440px;
  --header-height: 150px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-soft: 0 8px 24px rgb(32 53 44 / 8%);
  --font-body: "DM Sans", sans-serif;
  --font-display: "Fraunces", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
iframe:focus-visible {
  outline: 3px solid rgb(173 103 75 / 32%);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* Application shell and navigation */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 70;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 18px;
  overflow-y: auto;
  background: var(--sidebar);
  color: #e8eee4;
  flex-direction: column;
  transition: width 180ms ease, padding 180ms ease;
}

.brand {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
}

.brand-mark {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #d4e2c7;
  color: #345449;
  font-size: 20px;
}

.brand-copy {
  min-width: 0;
}

.brand strong {
  display: block;
  font: 600 23px/1 var(--font-display);
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #b9cdbf;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.sidebar-toggle {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 1px solid #6a8a7a;
  border-radius: var(--radius-sm);
  background: #36584b;
  color: #f3f6f1;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.sidebar-toggle::before {
  content: "☰";
  font-size: 18px;
}

.sidebar-toggle:hover {
  background: #466b5a;
}

.sidebar nav {
  display: grid;
  width: 100%;
  gap: 5px;
  margin-top: 48px;
}

.nav-item {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #bfd0c4;
  font: 600 13px var(--font-body);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item span {
  display: inline-grid;
  width: 28px;
  place-items: center;
  font-size: 18px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-hover);
  color: #fff;
}

.side-note {
  display: flex;
  gap: 9px;
  width: 100%;
  margin-top: auto;
  padding: 18px 2px 0;
  border-top: 1px solid #496557;
}

.side-note .dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #d3e29c;
  box-shadow: 0 0 0 4px #466657;
}

.side-note strong,
.side-note small {
  display: block;
}

.side-note strong {
  font-size: 12px;
}

.side-note small {
  margin-top: 5px;
  color: #b6cabd;
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-footer {
  margin-top: 18px;
  color: #b5c6ba;
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-footer span {
  color: #8eaa99;
}

.app-shell main {
  width: calc(100% - var(--sidebar-width));
  max-width: none;
  min-height: 100vh;
  margin: 0 0 0 var(--sidebar-width);
  padding: calc(var(--header-height) + 28px) clamp(24px, 4vw, 54px) 52px;
  transition: width 180ms ease, margin-left 180ms ease;
}

.app-shell.unauthenticated main {
  width: 100%;
  margin-left: 0;
  min-height: 100dvh;
  padding: clamp(18px, 4vw, 48px);
  background: radial-gradient(circle at 12% 0%, #edf3ea 0%, transparent 42%), radial-gradient(circle at 85% 18%, #e8f2f5 0%, transparent 40%), var(--cream);
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding-inline: 12px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-mark,
.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .side-note,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  margin: 0;
}

.app-shell.sidebar-collapsed .nav-item {
  padding-inline: 4px;
  overflow: hidden;
  font-size: 0;
  text-align: center;
}

.app-shell.sidebar-collapsed .nav-item span {
  width: auto;
  font-size: 19px;
}

.app-shell.sidebar-collapsed main {
  width: calc(100% - var(--sidebar-collapsed-width));
  margin-left: var(--sidebar-collapsed-width);
}

/* Fixed information header */
.topbar {
  position: fixed;
  inset: 0 0 auto var(--sidebar-width);
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr) auto;
  min-height: var(--header-height);
  gap: clamp(14px, 2vw, 28px);
  align-items: center;
  padding: 13px clamp(24px, 4vw, 54px);
  background: rgb(245 243 235 / 96%);
  box-shadow: 0 8px 18px -18px rgb(32 53 44 / 70%);
  backdrop-filter: blur(10px);
  transition: left 180ms ease;
}

.app-shell.sidebar-collapsed .topbar {
  left: var(--sidebar-collapsed-width);
}

.app-shell.unauthenticated .topbar {
  left: 0;
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow,
.kicker {
  margin: 0 0 6px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.25;
  text-transform: uppercase;
}

.topbar h1 {
  display: -webkit-box;
  max-width: 340px;
  overflow: hidden;
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1.08;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.status-bar {
  display: grid;
  grid-template-columns: auto auto minmax(420px, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100px;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--muted);
  box-shadow: 0 3px 10px rgb(32 53 44 / 5%);
}

.status-current,
.status-times,
.status-week,
.status-outlook {
  min-width: 0;
}

.status-current {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-weather-icon {
  flex: 0 0 auto;
  color: #aa8137;
  font-size: 27px;
}

.status-current strong {
  display: block;
  color: var(--deep);
  font: 600 14px/1.2 var(--font-display);
}

.status-current small,
.status-muted {
  display: block;
  margin-top: 2px;
  color: #849188;
  font-size: 12px;
  line-height: 1.25;
}

.status-times {
  display: grid;
  gap: 3px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}

.status-times span:first-child {
  color: #967532;
}

.status-times span:last-child {
  color: #69786f;
}

.status-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(70px, 1fr));
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.status-day {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 2px 5px;
  border-left: 1px solid #edf0ea;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}

.status-day b,
.status-day small,
.status-day em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-day-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.status-day b {
  color: var(--deep);
  font-size: 12px;
}

.status-day i {
  color: #a77d32;
  font-size: 13px;
  font-style: normal;
}

.status-day small,
.status-day em {
  font-size: 10px;
}

.status-day em {
  color: #788a80;
  font-style: normal;
}

.status-rain {
  padding: 2px 3px;
  border-radius: 5px;
  font-weight: 700;
  text-transform: capitalize;
}

.rain-dry { background: #edf2df; color: #557144 !important; }
.rain-light { background: #e5f0f2; color: #416a73 !important; }
.rain-moderate { background: #d4e4eb; color: #285c6f !important; }
.rain-heavy { background: #bfd5df; color: #174d63 !important; }
.rain-very-heavy { background: #9ebfce; color: #0d3d51 !important; }
.status-field { color: #5e7067 !important; }

.status-outlook {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px 14px;
  align-content: center;
  font-size: 12px;
  line-height: 1.25;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.status-outlook b {
  color: var(--deep);
  font-size: 12px;
}

.status-outlook span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-outlook strong {
  color: var(--moss);
}

/* Shared surfaces and controls */
.view {
  display: none;
  width: min(100%, var(--content-max));
  margin-inline: auto;
}

.active-view {
  display: block;
}

.primary-button,
.secondary-button,
.briefing-button,
.location-row button,
.back-groups,
.calendar-nav {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.primary-button,
.briefing-button,
.location-row button {
  padding: 9px 14px;
  border: 1px solid transparent;
  background: var(--deep);
  color: #fff;
}

.primary-button:hover,
.location-row button:hover {
  background: #3e6554;
}

.secondary-button,
.back-groups,
.calendar-nav {
  padding: 9px 12px;
  border: 1px solid #bfd0bf;
  background: var(--paper);
  color: var(--deep);
}

.quiet-button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf4;
  color: var(--moss);
  font: 600 12px var(--font-body);
  cursor: pointer;
}

.quiet-button:hover,
.secondary-button:hover,
.back-groups:hover,
.calendar-nav:hover {
  background: var(--sage);
}

.quiet-button.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

.chat-card,
.mini-card,
.profile-card,
.profile-map-card,
.planner-panel,
.account-panel,
.knowledge-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

/* Farm desk */
.welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  min-height: 226px;
  overflow: hidden;
  border-radius: 18px;
  background: #dfe8d7;
}

.welcome-copy {
  padding: 30px 34px;
}

.welcome-copy h2,
.knowledge-header h2 {
  font-size: clamp(27px, 3vw, 32px);
  line-height: 1.15;
}

.welcome-copy p:not(.kicker) {
  max-width: 580px;
  margin: 12px 0 20px;
  color: #506a5e;
  line-height: 1.6;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chips button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #b7cbb8;
  border-radius: 18px;
  background: #eef3e8;
  color: #3c5d50;
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.prompt-chips button:hover {
  background: #f8fbf3;
}

.field-illustration {
  --sun-x: 50%;
  --sun-y: 20%;
  position: relative;
  min-height: 226px;
  overflow: hidden;
  background: linear-gradient(#e1eadc 0 49%, #d7e4d2 49%);
  transition: background 700ms;
}

.hill {
  position: absolute;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: scaleX(1.35);
}

.hill-back {
  bottom: 38px;
  left: 2%;
  width: 370px;
  height: 116px;
  background: #adc9aa;
}

.hill-front {
  bottom: -6px;
  left: -4%;
  width: 450px;
  height: 92px;
  background: #6e9b72;
}

.sun-orb {
  position: absolute;
  z-index: 2;
  top: var(--sun-y);
  left: var(--sun-x);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 9px rgb(234 223 155 / 34%);
  transform: translate(-50%, -50%);
  transition: left 1.2s ease, top 1.2s ease, background 700ms, box-shadow 700ms;
}

.grass {
  position: absolute;
  bottom: 29px;
  color: #45735a;
  font-size: 36px;
}

.grass-1 { right: 18%; }
.grass-2 { right: 8%; bottom: 17px; }
.grass-3 { right: 30%; bottom: 2px; }

.sky-cloud {
  position: absolute;
  z-index: 1;
  width: 90px;
  height: 22px;
  border-radius: 20px;
  background: rgb(255 255 255 / 54%);
  filter: blur(1px);
  transition: opacity 700ms;
}

.cloud-one { top: 26%; left: 13%; }
.cloud-two { top: 38%; right: 13%; transform: scale(0.7); }

.rain-overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(105deg, transparent 0 13px, rgb(255 255 255 / 40%) 14px 15px, transparent 16px 25px);
  transition: opacity 500ms;
}

.field-illustration.is-rain .rain-overlay { opacity: 0.35; }
.field-illustration.is-cloudy .sky-cloud { opacity: 0.75; }
.field-illustration:not(.is-cloudy) .sky-cloud { opacity: 0.15; }
.field-illustration.is-rain .hill-front { filter: saturate(0.7) brightness(0.9); }

.field-illustration.is-night {
  background: linear-gradient(#344b59 0 49%, #3d6857 49%);
}

.field-illustration.is-night .sun-orb {
  background: #e9e2b7;
  box-shadow: 0 0 0 7px rgb(233 226 183 / 20%);
}

.field-illustration.is-night .sky-cloud {
  background: rgb(255 255 255 / 13%);
}

.weather-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.weather-location {
  position: relative;
}

.location-row {
  display: flex;
  gap: 7px;
}

.location-row input,
.chat-form input,
.knowledge-toolbar input,
.suggestion-card input,
.profile-card input,
.profile-card textarea,
.account-panel input,
.modal-panel input,
.modal-panel select,
.modal-panel textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfaf4;
  color: var(--ink);
  font: 14px var(--font-body);
}

.location-row input,
.chat-form input,
.knowledge-toolbar input,
.suggestion-card input {
  padding: 10px 12px;
}

.location-results {
  position: absolute;
  z-index: 20;
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.location-results:empty {
  display: none;
}

.location-results button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: 13px var(--font-body);
  text-align: left;
}

.weather-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.weather-summary strong {
  font: 600 18px var(--font-display);
}

.weather-summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.weather-icon {
  color: #aa8137;
  font-size: 30px;
}

.briefing-button {
  background: #9b5f48;
  white-space: nowrap;
}

.briefing-button:hover {
  background: #844c38;
}

.desk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 20px;
  margin-top: 20px;
}

/* Conversation workspace */
.chat-card {
  position: relative;
  display: flex;
  height: clamp(500px, 68dvh, 680px);
  max-height: calc(100dvh - 32px);
  min-width: 0;
  min-height: min(500px, calc(100dvh - 32px));
  padding: 22px;
  overflow: hidden;
  flex-direction: column;
}

.card-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-heading h3 {
  font-size: 23px;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status {
  color: #6d8879;
  font-size: 12px;
  white-space: nowrap;
}

.status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #769c59;
}

.chat-messages {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 4px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.bubble {
  max-width: min(80%, 680px);
  padding: 12px 15px;
  border-radius: 13px 13px 13px 3px;
  background: #eff3eb;
  color: #385448;
  font-size: 14px;
  line-height: 1.55;
}

.bubble.user {
  align-self: flex-end;
  border-radius: 13px 13px 3px 13px;
  background: #496d5c;
  color: #fff;
}

.bubble.degraded,
.bubble.refusal {
  border: 1px solid #d4b875;
  background: #fff8e8;
  color: #53482f;
}

.bubble.refusal {
  border-color: #cfaaa0;
  background: #fff3ef;
  color: #654139;
}

.bubble-status {
  display: block;
  width: fit-content;
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgb(83 72 47 / 18%);
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.35;
}

.bubble .question-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.chat-form {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-form button {
  flex: 0 0 44px;
  width: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--deep);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}

.chat-form button:hover {
  background: #3e6554;
}

.privacy-note {
  flex: 0 0 auto;
  margin: 9px 2px 0;
  color: #7d8c84;
  font-size: 12px;
}

.conversation-history {
  min-width: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf4;
}

.history-group + .history-group {
  margin-top: 16px;
}

.history-drawer-heading {
  position: sticky;
  z-index: 1;
  top: -14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -14px -14px 12px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf4;
}

.history-drawer-heading strong {
  color: var(--deep);
  font: 600 17px var(--font-display);
}

#new-conversation-button {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #bfd0bf;
  border-radius: 7px;
  background: var(--paper);
  color: var(--deep);
  font: 700 12px var(--font-body);
  cursor: pointer;
}

#new-conversation-button:hover {
  background: var(--sage);
}

.history-group h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: 7px;
}

.history-entry:hover,
.history-entry.active {
  background: var(--sage);
}

.history-item {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--deep);
  text-align: left;
  cursor: pointer;
}

.history-item strong {
  overflow: hidden;
  font: 500 13px var(--font-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item small,
.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.history-item-actions {
  display: flex;
  gap: 2px;
  padding-right: 5px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.history-entry:hover .history-item-actions,
.history-entry:focus-within .history-item-actions {
  opacity: 1;
}

@media (hover: none) {
  .history-item-actions {
    opacity: 1;
  }
}

.history-item-actions button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.history-item-actions button:hover {
  background: var(--paper);
  color: var(--deep);
}

.history-empty {
  margin: 4px;
}

.chat-card.history-open {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  column-gap: 20px;
}

.chat-card.history-open .card-heading {
  grid-column: 1 / -1;
  grid-row: 1;
  margin-bottom: 14px;
}

.chat-card.history-open .conversation-history {
  grid-column: 1;
  grid-row: 2 / 5;
  min-height: 0;
  border-radius: 10px;
}

.chat-card.history-open .chat-messages {
  grid-column: 2;
  grid-row: 2;
  width: auto;
  min-width: 0;
  margin: 0;
}

.chat-card.history-open .chat-form {
  grid-column: 2;
  grid-row: 3;
  width: auto;
  min-width: 0;
  margin: 0;
}

.chat-card.history-open .privacy-note {
  grid-column: 2;
  grid-row: 4;
  margin-left: 2px;
}

.chat-fullscreen {
  position: fixed;
  z-index: 100;
  inset: 18px 18px 18px calc(var(--sidebar-width) + 18px);
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  box-shadow: 0 18px 60px rgb(32 53 44 / 24%);
}

.app-shell.sidebar-collapsed .chat-fullscreen {
  left: calc(var(--sidebar-collapsed-width) + 18px);
}

.chat-fullscreen .chat-messages {
  min-height: 0;
}

.conversation-open {
  overflow: hidden;
}

.right-rail {
  display: grid;
  align-content: start;
  gap: 18px;
}

.mini-card {
  padding: 19px;
}

.mini-heading {
  display: flex;
  justify-content: space-between;
  color: #74867c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.leaf {
  color: #699274;
  font-size: 18px;
}

.mini-card strong {
  display: block;
  margin-top: 18px;
  font: 600 20px var(--font-display);
}

.mini-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric-card {
  border-color: #e5d9ae;
  background: #f0e8c7;
}

.farm-snapshot-card {
  background: #f4efe0;
  border-color: #ded5b9;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0 13px;
  overflow: hidden;
  border: 1px solid #dfd7be;
  border-radius: 10px;
  background: #dfd7be;
}

.snapshot-grid > div {
  min-width: 0;
  padding: 11px 8px;
  background: rgb(255 253 248 / 72%);
  text-align: center;
}

.snapshot-grid strong {
  margin: 0;
  overflow: hidden;
  color: var(--deep);
  font: 600 19px/1.2 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.metric-number {
  margin: 14px 0 0;
  color: #506d58;
  font: 600 46px var(--font-display);
}

.metric-label { margin: 2px 0 14px; }
.tiny { font-size: 12px; }

.progress {
  height: 5px;
  border-radius: 5px;
  background: #d9d3ad;
}

.progress span {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: 5px;
  background: #8b9f69;
}

.week-todo-summary {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.week-todo-summary button,
.planner-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--deep);
  font: 600 12px var(--font-body);
  text-align: left;
  cursor: pointer;
}

.week-todo-summary button span {
  margin-right: 6px;
  color: var(--clay);
}

.planner-link {
  padding-top: 11px;
  color: var(--moss);
}

/* Knowledge, integrations and roadmap */
.knowledge-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 30px;
  border-radius: var(--radius-lg);
  background: #e7eee3;
}

.knowledge-header p:not(.kicker) {
  max-width: 680px;
  margin: 9px 0 0;
  color: #566d62;
  line-height: 1.55;
}

.knowledge-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 13px;
}

.tabs,
.planner-tabs {
  display: flex;
  gap: 5px;
}

.knowledge-tab,
.planner-tab {
  min-height: 40px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.knowledge-tab.active,
.planner-tab.active {
  border-bottom-color: var(--clay);
  color: var(--deep);
}

.knowledge-tab span {
  margin-left: 4px;
  padding: 3px 7px;
  border-radius: 10px;
  background: #e6ebe3;
  font-size: 12px;
}

.knowledge-toolbar input {
  max-width: 320px;
}

.knowledge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-item {
  min-width: 0;
  padding: 17px;
}

.knowledge-item h4 {
  margin: 0 0 8px;
  font: 600 17px var(--font-display);
}

.knowledge-item p {
  margin: 4px 0;
  color: #5f7469;
  font-size: 13px;
  line-height: 1.5;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: #7e8c84;
  font-size: 12px;
}

.edit-link {
  padding: 2px 4px;
  border: 0;
  background: none;
  color: #8c5c46;
  font: 700 12px var(--font-body);
  cursor: pointer;
}

.knowledge-group-overview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.knowledge-group-card {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms, box-shadow 150ms;
}

.knowledge-group-card:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.knowledge-group-card h3 {
  margin: 11px 0 7px;
  color: var(--deep);
  font: 600 21px var(--font-display);
}

.knowledge-group-card p {
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.group-card-count,
.group-card-link {
  color: var(--clay);
  font-size: 12px;
  font-weight: 700;
}

.group-card-count {
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.group-card-link {
  color: var(--moss);
}

.knowledge-group-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 1px;
  padding: 16px 19px;
  border-radius: 13px;
  background: #edf2e9;
}

.knowledge-group-toolbar h2 {
  font-size: 25px;
}

.knowledge-group-toolbar p:not(.kicker) {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-category {
  grid-column: 1 / -1;
  padding: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #edf2e9;
}

.knowledge-category h3 {
  margin: 12px 2px 8px;
  color: var(--deep);
  font: 600 21px var(--font-display);
}

.knowledge-category h3 span,
.knowledge-category summary em {
  padding: 4px 7px;
  border-radius: 10px;
  background: var(--sage);
  color: var(--moss);
  font: 600 12px var(--font-body);
}

.knowledge-category summary,
.knowledge-subgroup-panel summary {
  cursor: pointer;
  list-style: none;
}

.knowledge-category summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  color: var(--deep);
  font: 600 21px var(--font-display);
}

.knowledge-category summary::-webkit-details-marker,
.knowledge-subgroup-panel summary::-webkit-details-marker {
  display: none;
}

.knowledge-category summary::before,
.knowledge-subgroup-panel summary::before {
  margin-right: 8px;
  color: var(--clay);
  content: "+";
  font-family: var(--font-body);
}

.knowledge-category[open] summary::before,
.knowledge-subgroup-panel[open] summary::before {
  content: "−";
}

.knowledge-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-subgroup,
.knowledge-subgroup-panel {
  margin: 2px 0 13px;
}

.knowledge-subgroup > h4 {
  margin: 10px 3px 7px;
  color: var(--moss);
  font: 600 13px var(--font-body);
  letter-spacing: 0.05em;
  text-transform: capitalize;
}

.knowledge-subgroup > h4 span,
.knowledge-subgroup-panel summary span {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
}

.knowledge-subgroup-panel {
  grid-column: 1 / -1;
  padding: 0 10px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f3f5ef;
}

.knowledge-subgroup-panel summary {
  padding: 12px 5px;
  color: var(--moss);
  font: 600 13px var(--font-body);
  text-transform: capitalize;
}

.knowledge-subgroup-panel summary span {
  float: right;
}

.knowledge-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-pagination button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--deep);
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.integrations {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.integrations h3 {
  font-size: 24px;
}

.integration-intro {
  max-width: 680px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.integration-grid article {
  min-width: 0;
  padding: 16px;
  border: 1px dashed #c3d0c2;
  border-radius: 11px;
  background: #fbfaf4;
}

.integration-grid h4 {
  margin: 9px 0 5px;
  font: 600 17px var(--font-display);
}

.integration-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.integration-status {
  color: #9b5f48;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.implemented-status {
  color: #52765b;
}

.integrations-panel,
.integrations-panel .integrations {
  display: block;
}

.integrations-panel .integrations {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.suggestion-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.suggestion-card h3 {
  font-size: 22px;
}

.suggestion-card p:not(.kicker) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.suggestion-card form {
  display: flex;
  gap: 8px;
}

.feature-suggestions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.feature-suggestions span {
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--sage);
  color: var(--deep);
  font-size: 12px;
}

.feature-suggestions small {
  color: var(--muted);
  font-size: 12px;
}

/* Farm profile and account */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
  margin-top: 20px;
}

.profile-card,
.profile-map-card,
.account-panel {
  padding: 21px;
}

.profile-card h3,
.profile-map-card h3 {
  margin: 0 0 16px;
  font: 600 21px var(--font-display);
}

.profile-card label,
.account-panel label,
.modal-panel label {
  display: block;
  margin: 13px 0;
  color: #526b60;
  font-size: 13px;
  font-weight: 600;
}

.profile-card input,
.profile-card textarea,
.account-panel input,
.modal-panel input,
.modal-panel select,
.modal-panel textarea {
  display: block;
  margin-top: 6px;
  padding: 10px;
}

.profile-card textarea {
  resize: vertical;
  line-height: 1.45;
}

.profile-note,
.profile-map-heading p,
.account-panel p,
.account-panel small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-note {
  margin-top: 17px;
}

.profile-section-heading {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-location {
  margin-top: 18px;
}

.profile-map-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.profile-map-heading p {
  margin: 3px 0;
}

.profile-map-card iframe {
  display: block;
  width: 100%;
  height: 360px;
  margin-top: 14px;
  border: 0;
  border-radius: 9px;
  background: #e5ece2;
}

.map-placeholder {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed #cbbf91;
  border-radius: 9px;
  background: #f0e8c7;
  color: #65735c;
  font-size: 13px;
  flex-direction: column;
}

.map-placeholder strong {
  color: #68764f;
}

.account-panel {
  max-width: 540px;
  margin-top: 20px;
}

.account-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.account-panel small {
  display: block;
  margin-top: 12px;
}

/* Planner and calendar */
.planner-badge,
.planner-count {
  padding: 6px 9px;
  border-radius: 14px;
  background: var(--sage);
  color: var(--moss);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.planner-tabs {
  margin-top: 18px;
  border-bottom: 1px solid var(--line);
}

.planner-panel {
  max-width: 980px;
  margin-top: 20px;
  padding: 22px;
}

.planner-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.planner-heading h3 {
  font-size: 23px;
}

.planner-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.planner-list {
  display: grid;
}

.task-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 38px 16px 4px;
  border-bottom: 1px solid #edf0ea;
  cursor: pointer;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row input {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--deep);
}

.task-row span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.task-row strong {
  color: var(--deep);
  font: 600 17px var(--font-display);
}

.task-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.task-delete {
  position: absolute;
  top: 12px;
  right: 2px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #936b58;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.task-delete:hover {
  background: #f4e9e2;
  color: #8b4533;
}

.task-done {
  opacity: 0.72;
}

.task-done strong,
.task-done small {
  color: #78867e;
  text-decoration: line-through;
}

.planner-empty {
  padding: 28px 5px;
  color: var(--muted);
  font-size: 13px;
}

.planner-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--deep);
  font: 600 19px var(--font-display);
}

.history-week {
  margin-bottom: 17px;
  padding: 4px 0 17px;
  border-bottom: 1px solid var(--line);
}

.history-week h3 {
  margin: 0 0 10px;
  color: var(--deep);
  font: 600 20px var(--font-display);
}

.history-task {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 0;
}

.history-task > span {
  color: var(--clay);
  font-size: 14px;
}

.history-task strong,
.history-task small {
  display: block;
}

.history-task strong {
  color: var(--deep);
  font-size: 14px;
}

.history-task small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.calendar-heading h3 {
  display: inline-block;
  margin-left: 8px;
  font: 600 22px var(--font-display);
}

.calendar-heading small,
.calendar-weekdays b,
.calendar-cell > b {
  color: var(--muted);
  font-size: 12px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-weekdays b {
  color: var(--moss);
  text-align: center;
}

.calendar-grid {
  margin-top: 6px;
}

.calendar-cell {
  min-width: 0;
  min-height: 72px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf4;
  color: var(--deep);
}

.calendar-cell.empty {
  border: 0;
  background: transparent;
}

.calendar-cell i {
  display: block;
  width: auto;
  min-height: 20px;
  margin-top: 6px;
  padding: 3px 4px;
  overflow: hidden;
  border-radius: 5px;
  background: #e8d99a;
  color: #6d542d;
  font: 600 12px/1.2 var(--font-body);
  font-style: normal;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-cell i.calendar-done {
  background: #a9c5a5;
  color: #315943;
}

.fc {
  color: var(--ink);
  font-family: var(--font-body);
}

.fc .fc-toolbar-title {
  color: var(--deep);
  font: 600 22px var(--font-display);
}

.fc .fc-button {
  border-color: var(--deep);
  background: var(--deep);
  font-size: 12px;
}

.fc .fc-daygrid-day-number,
.fc .fc-daygrid-event {
  font-size: 12px;
}

.fc .fc-daygrid-day-number {
  color: var(--deep);
}

.fc .fc-daygrid-event {
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
}

.fc .calendar-event-done {
  background: #a9c5a5;
  color: #315943;
  text-decoration: line-through;
}

.fc .calendar-event-open {
  background: #e8d99a;
  color: #6d542d;
}

/* Modal */
.modal {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgb(32 53 44 / 50%);
}

.modal-panel {
  position: relative;
  width: min(550px, 100%);
  max-height: 90vh;
  max-height: 90dvh;
  padding: 28px;
  overflow: auto;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 18px 60px rgb(32 53 44 / 24%);
}

.modal-panel h3 {
  margin-bottom: 22px;
  font-size: 26px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--sage);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-panel .primary-button {
  margin-top: 10px;
}

/* Medium desktop and tablet */
@media (max-width: 1180px) {
  :root {
    --header-height: 170px;
  }

  .topbar {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  }

  .status-bar {
    grid-template-columns: auto auto minmax(290px, 1fr);
  }

  .status-outlook {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    padding-top: 5px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
  }

  .status-outlook b {
    width: auto;
  }

  .knowledge-group-overview,
  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 210px;
    --header-height: 198px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    align-content: center;
  }

  .topbar h1 {
    max-width: none;
    font-size: 24px;
    -webkit-line-clamp: 1;
  }

  .status-bar {
    min-height: 100px;
  }

  .welcome-grid {
    grid-template-columns: 1fr;
  }

  .field-illustration {
    min-height: 180px;
  }

  .desk-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-card.history-open {
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 14px;
  }

  .knowledge-list,
  .knowledge-category-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile navigation becomes a compact sticky header. */
@media (max-width: 700px) {
  :root {
    --header-height: auto;
  }

  body {
    overflow-x: hidden;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 80;
    display: block;
    width: 100%;
    min-height: 0;
    max-height: none;
    padding: 10px 12px 8px;
    overflow: visible;
  }

  .brand,
  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .brand-mark,
  .app-shell.sidebar-collapsed .brand-mark {
    display: grid;
  }

  .brand-copy,
  .app-shell.sidebar-collapsed .brand-copy {
    display: block;
  }

  .brand strong {
    font-size: 20px;
  }

  .brand small {
    font-size: 12px;
  }

  .sidebar-toggle,
  .app-shell.sidebar-collapsed .sidebar-toggle {
    margin-left: auto;
  }

  .sidebar nav {
    display: flex;
    width: calc(100vw - 24px);
    gap: 4px;
    margin-top: 8px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-shell.sidebar-collapsed .sidebar nav {
    display: none;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item,
  .app-shell.sidebar-collapsed .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 7px 10px;
    overflow: visible;
    font-size: 12px;
  }

  .nav-item span,
  .app-shell.sidebar-collapsed .nav-item span {
    width: 22px;
    font-size: 16px;
  }

  .side-note,
  .sidebar-footer,
  .app-shell.sidebar-collapsed .side-note,
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: none;
  }

  .app-shell main,
  .app-shell.sidebar-collapsed main {
    width: 100%;
    margin: 0;
    padding: 0 14px 36px;
  }

  .topbar,
  .app-shell.sidebar-collapsed .topbar {
    position: sticky;
    inset: 0 auto auto;
    z-index: 40;
    display: block;
    min-height: 0;
    margin-inline: -14px;
    padding: 11px 14px 10px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar h1 {
    margin-bottom: 8px;
    font-size: 20px;
    line-height: 1.15;
    -webkit-line-clamp: 1;
  }

  .status-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 8px 9px;
  }

  .status-times {
    justify-self: end;
  }

  .status-week {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-day:nth-child(n + 4) {
    display: none;
  }

  .status-outlook {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px 12px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
  }

  .status-outlook b {
    display: none;
  }

  .welcome-copy {
    padding: 23px;
  }

  .welcome-copy h2,
  .knowledge-header h2 {
    font-size: 26px;
  }

  .field-illustration {
    min-height: 160px;
  }

  .weather-strip {
    grid-template-columns: 1fr;
  }

  .briefing-button {
    width: 100%;
    white-space: normal;
  }

  .right-rail,
  .knowledge-group-overview,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .chat-card {
    height: min(620px, calc(100dvh - 24px));
    min-height: min(420px, calc(100dvh - 24px));
    padding: 16px;
  }

  .card-heading {
    gap: 8px;
  }

  .conversation-actions .status {
    display: none;
  }

  .bubble {
    max-width: 90%;
  }

  .chat-card.history-open {
    display: flex;
  }

  .chat-card.history-open .conversation-history {
    position: absolute;
    z-index: 5;
    inset: 64px 14% 14px 0;
    display: block;
    min-height: 0;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 8px 0 20px rgb(32 53 44 / 12%);
  }

  .chat-fullscreen,
  .app-shell.sidebar-collapsed .chat-fullscreen {
    inset: 10px;
    left: 10px;
    min-height: 0;
  }

  .knowledge-header {
    display: block;
    padding: 23px;
  }

  .knowledge-header .primary-button,
  .planner-badge {
    margin-top: 16px;
  }

  .knowledge-toolbar {
    display: block;
  }

  .knowledge-toolbar input {
    width: 100%;
    max-width: none;
    margin-top: 10px;
  }

  .knowledge-group-toolbar,
  .profile-map-heading {
    display: block;
  }

  .back-groups,
  .profile-map-heading .integration-status {
    margin-bottom: 12px;
  }

  .suggestion-card {
    display: block;
  }

  .suggestion-card form {
    display: grid;
    margin-top: 14px;
  }

  .feature-suggestions {
    margin-top: 14px;
  }

  .planner-tabs,
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .planner-tab,
  .knowledge-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .planner-panel {
    padding: 16px;
  }

  .calendar-cell {
    min-height: 52px;
    padding: 4px;
  }

  .calendar-cell i {
    min-height: 17px;
    margin-top: 4px;
    padding: 2px;
    font-size: 12px;
  }

  .fc .fc-toolbar {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .status-current small,
  .status-outlook span:nth-of-type(n + 3) {
    display: none;
  }

  .welcome-grid {
    border-radius: 14px;
  }

  .prompt-chips button {
    width: 100%;
  }

  .chat-card {
    margin-inline: -4px;
  }

  .planner-heading {
    display: block;
  }

  .planner-count {
    display: inline-block;
    margin-top: 10px;
  }

  .account-actions {
    display: grid;
  }
}

.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-chips span {
  border-radius: 999px;
  background: var(--sage);
  color: var(--deep);
  padding: 4px 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: capitalize;
}

.task-completion,
.task-reason {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.task-completion b {
  color: var(--deep);
}

/* Scheduled adviser and alert centre */
.alert-bell {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--deep);
  font-size: 25px;
  cursor: pointer;
}

.alert-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #a33c2f;
  color: white;
  font: 700 11px/20px system-ui;
}

.alert-drawer {
  position: fixed;
  z-index: 90;
  top: 14px;
  right: 14px;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 20px 60px rgb(20 38 29 / 24%);
}

.alert-drawer-heading,
.alert-card-top,
.alert-actions,
.switch-row,
.automation-status > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-drawer-heading h2,
.alert-group > h3,
.alert-card h3,
.automation-card h3 { margin: 0; }
.alert-drawer-heading > button { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.alert-list { display: grid; gap: 12px; margin: 16px 0; }
.alerts-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 24px; align-items: start; }
.alert-history, .alert-group { display: grid; gap: 14px; }
.alert-group { margin-bottom: 24px; }
.alert-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-left: 5px solid #7a8c79;
  border-radius: 14px;
  background: #fffef9;
}
.alert-card.severity-high { border-left-color: #d18a22; }
.alert-card.severity-urgent { border-left-color: #a33c2f; }
.alert-card-top { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.alert-card h3 { margin-top: 8px; }
.alert-card p { margin: 7px 0; line-height: 1.45; }
.alert-rationale { color: var(--muted); }
.alert-actions { justify-content: flex-start; margin-top: 14px; }
.automation-card { position: sticky; top: calc(var(--header-height) + 20px); display: grid; gap: 15px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.automation-card label { display: grid; gap: 6px; font-weight: 650; }
.automation-card input[type="time"], .automation-card select { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.switch-row { display: flex !important; padding: 12px; border-radius: 10px; background: var(--sage); }
.switch-row span { display: grid; gap: 3px; }
.switch-row small { color: var(--muted); font-weight: 400; }
.switch-row input { width: 22px; height: 22px; }
.automation-status { display: grid; gap: 8px; margin: 0; }
.automation-status > div { align-items: baseline; }
.automation-status dt { color: var(--muted); }
.automation-status dd { margin: 0; text-align: right; font-weight: 650; }
.scheduled-label { color: var(--moss) !important; font-weight: 700; }
.task-highlight { outline: 3px solid rgb(209 138 34 / 35%); }

@media (max-width: 900px) {
  .alerts-layout { grid-template-columns: 1fr; }
  .automation-card { position: static; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .topbar .status-bar { grid-column: 1 / -1; }
}

.account-layout,
.security-grid,
.admin-layout { display: grid; gap: 20px; }
.account-layout { grid-template-columns: minmax(280px, .65fr) minmax(0, 1.35fr); align-items: start; }
.security-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.security-card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.danger-card { border-color: #c98f86; background: #fff9f7; }
.danger-card .quiet-button { color: #8f2f24; }
.security-card h3 { margin-top: 0; }
.security-card form, .security-card label { display: grid; gap: 9px; }
.security-card form { gap: 14px; }
.security-card input, .security-card select, .admin-toolbar input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.security-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.security-row span, .credential-status { display: grid; gap: 3px; }
.security-row small, .credential-status span { color: var(--muted); }
.credential-status { padding: 12px; margin: 12px 0; border-radius: 10px; background: var(--sage); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-grid > div { display: grid; gap: 3px; padding: 14px; border-radius: 12px; background: var(--sage); }
.metric-grid strong { font-size: 24px; color: var(--deep); }
.metric-grid span { color: var(--muted); font-size: 12px; }
.admin-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.admin-layout { grid-template-columns: minmax(240px, .45fr) minmax(0, 1.55fr); align-items: start; }
.admin-users-card { min-width: 0; }
.admin-audit-card { grid-column: 1 / -1; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.admin-toolbar h3 { margin: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-scroll th, .table-scroll td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.table-scroll td:first-child { display: grid; gap: 3px; white-space: normal; min-width: 180px; }
.table-scroll td small { color: var(--muted); }

.app-shell.unauthenticated main {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 8% 5%, rgb(213 226 199 / 72%) 0, transparent 31%),
    radial-gradient(circle at 94% 88%, rgb(223 206 176 / 45%) 0, transparent 28%),
    linear-gradient(145deg, #f8f5ec 0%, #edf2e9 100%);
}

.app-shell.unauthenticated #account-view {
  width: min(100%, 1080px);
  margin-inline: auto;
}

.auth-gateway {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(390px, .94fr);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid rgb(48 76 64 / 16%);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgb(32 53 44 / 16%);
  animation: auth-arrive 500ms cubic-bezier(.2, .75, .25, 1) both;
}

.auth-landing {
  position: relative;
  display: flex;
  min-height: 650px;
  padding: clamp(30px, 5vw, 54px);
  overflow: hidden;
  background: var(--deep);
  color: #f8f6ee;
  flex-direction: column;
}

.auth-landing::before,
.auth-landing::after {
  position: absolute;
  border: 1px solid rgb(223 233 220 / 18%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.auth-landing::before { right: -210px; bottom: -230px; width: 530px; height: 530px; box-shadow: 0 0 0 38px rgb(223 233 220 / 4%), 0 0 0 78px rgb(223 233 220 / 3%); }
.auth-landing::after { right: 60px; bottom: 62px; width: 8px; height: 8px; background: var(--yellow); box-shadow: -70px 44px 0 -2px #9eb296, 42px -86px 0 -2px #d7a582; }

.auth-brand { position: relative; z-index: 1; display: inline-flex; align-items: center; align-self: flex-start; gap: 12px; }
.auth-brand-mark { position: relative; display: block; width: 42px; height: 42px; overflow: hidden; border-radius: 50%; background: #dce8cf; }
.auth-brand-mark i { position: absolute; left: 7px; width: 29px; height: 15px; border: 2px solid var(--deep); border-radius: 50%; transform: rotate(-12deg); }
.auth-brand-mark i:nth-child(1) { top: 6px; }
.auth-brand-mark i:nth-child(2) { top: 13px; }
.auth-brand-mark i:nth-child(3) { top: 20px; }
.auth-brand-copy { min-width: 0; }
.auth-brand-copy strong { display: block; color: #fffdf7; font: 600 25px/1 var(--font-display); letter-spacing: -0.025em; }
.auth-brand-copy small { display: block; margin-top: 5px; color: #bacbc0; font-size: 11px; letter-spacing: .035em; }

.auth-story { position: relative; z-index: 1; max-width: 450px; margin: auto 0; padding: 50px 0; }
.auth-story .auth-strap,
.auth-panel .auth-eyebrow { margin: 0 0 13px; color: #d7dc9a; font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.auth-story h2 { max-width: 410px; color: #fffdf7; font-size: clamp(39px, 5vw, 58px); line-height: 1.04; }
.auth-story > p:not(.auth-strap) { max-width: 400px; margin: 22px 0 0; color: #cbd8cf; font-size: 16px; line-height: 1.7; }
.auth-features { display: flex; gap: 9px; margin-top: 32px; flex-wrap: wrap; }
.auth-features span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid rgb(231 239 228 / 15%); border-radius: 999px; background: rgb(255 255 255 / 5%); color: #e7ede7; font-size: 11px; }
.auth-features b { color: #d7dc9a; font-size: 9px; letter-spacing: .08em; }
.auth-private { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0; color: #aabeb2; font-size: 11px; letter-spacing: .025em; }
.auth-private span { width: 7px; height: 7px; border-radius: 50%; background: #bfca76; box-shadow: 0 0 0 4px rgb(191 202 118 / 12%); }

.auth-panel { align-self: center; width: 100%; max-width: none; margin: 0; padding: clamp(34px, 6vw, 64px); border: 0; background: var(--paper); }
.auth-panel-heading h2 { font-size: clamp(31px, 4vw, 42px); line-height: 1.12; }
.auth-panel-heading > p:last-child { max-width: 390px; margin: 13px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.auth-panel .auth-eyebrow { color: var(--clay); }
.auth-panel form { margin-top: 28px; }
.auth-panel label { margin: 17px 0; color: var(--ink); font-size: 12px; letter-spacing: .015em; }
.auth-panel input { min-height: 50px; margin-top: 8px; padding: 12px 14px; border: 1px solid #cad5cc; border-radius: 10px; background: #fffefa; color: var(--ink); transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.auth-panel input:hover { border-color: #9db1a3; }
.auth-panel input:focus { border-color: var(--moss); background: #fff; box-shadow: 0 0 0 4px rgb(89 116 102 / 10%); outline: 0; }
.auth-panel input::placeholder { color: #9aa79f; }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-label-row a { color: var(--moss); font-size: 11px; font-weight: 600; text-decoration: none; }
.auth-label-row a:hover { color: var(--clay); text-decoration: underline; }
.auth-password-field { position: relative; display: block; }
.auth-password-field input { padding-right: 64px; }
.auth-password-field button { position: absolute; right: 7px; bottom: 7px; min-width: 49px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--moss); font-size: 11px; font-weight: 700; cursor: pointer; }
.auth-password-field button:hover { background: var(--sage); }
.auth-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; margin-top: 24px; padding: 12px 17px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 22px rgb(48 76 64 / 18%); }
.auth-submit span:last-child { font-size: 18px; transition: transform 150ms ease; }
.auth-submit:hover span:last-child { transform: translateX(3px); }

.auth-message { display: none; margin: 18px 0 -8px; padding: 10px 12px; border-radius: 8px; font-size: 12px; line-height: 1.5; }
.auth-message:not(:empty) { display: block; }
.auth-message.pending { background: #eef2e9; color: var(--deep); }
.auth-message.error { border: 1px solid #e5c2b7; background: #fff3ee; color: #8d3f2f; }
.auth-message.success { border: 1px solid #c6d8c7; background: #eef7ec; color: #315b42; }
.auth-beta-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.auth-beta-note > span { display: grid; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; place-items: center; border-radius: 50%; background: var(--sage); color: var(--deep); font-family: var(--font-display); font-size: 12px; font-weight: 600; }
.auth-panel .auth-beta-note p { margin: 0; color: #718178; font-size: 11px; line-height: 1.55; }
.auth-panel .auth-beta-note strong { color: #52675c; }

.app-shell:not(.unauthenticated) #account-view .auth-landing { display: none; }
.app-shell:not(.unauthenticated) #account-view .auth-gateway { display: block; min-height: 0; border: 0; background: transparent; box-shadow: none; animation: none; }
.app-shell:not(.unauthenticated) #account-view .auth-panel { max-width: 540px; padding: 21px; border: 1px solid var(--line); border-radius: 14px; }
.app-shell:not(.unauthenticated) #account-view .auth-panel-heading,
.app-shell:not(.unauthenticated) #account-view .auth-beta-note { display: none; }
.app-shell:not(.unauthenticated) #account-view .account-layout { display: block; margin-top: 20px; }

@keyframes auth-arrive {
  from { opacity: 0; transform: translateY(12px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
  .account-layout, .security-grid, .admin-layout { grid-template-columns: 1fr; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-audit-card { grid-column: auto; }
  .auth-gateway { grid-template-columns: 1fr; }
  .auth-landing { min-height: 340px; padding: 30px; }
  .auth-story { margin: 42px 0 22px; padding: 0; }
  .auth-story h2 { max-width: 560px; font-size: clamp(36px, 8vw, 50px); }
  .auth-story > p:not(.auth-strap) { max-width: 560px; }
  .auth-private { margin-top: auto; }
  .auth-panel { padding: clamp(30px, 7vw, 50px); }
}

@media (max-width: 560px) {
  .app-shell.unauthenticated main { display: block; padding: 0; }
  .app-shell.unauthenticated #account-view { width: 100%; }
  .auth-gateway { min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .auth-landing { min-height: 290px; padding: 25px 22px; }
  .auth-brand-mark { width: 37px; height: 37px; }
  .auth-brand-mark i { left: 6px; width: 26px; }
  .auth-brand-copy strong { font-size: 22px; }
  .auth-story { margin: 34px 0 18px; }
  .auth-story h2 { font-size: 36px; }
  .auth-story > p:not(.auth-strap) { margin-top: 15px; font-size: 14px; }
  .auth-features { display: none; }
  .auth-panel { align-self: start; padding: 35px 22px 42px; }
  .auth-panel-heading h2 { font-size: 34px; }
}

/* Utility class remains last so component display rules never defeat it. */
.hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}
