/* Shared type, controls and content. */
html { font-size: 16px; }
body { font-size: 1rem; line-height: 1.45; }
h1, h2, h3 { overflow-wrap: anywhere; }
button, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid #276f31;
  outline-offset: 3px;
}
.content { max-width: 1300px; }
.ux-back { display:inline-flex; align-items:center; min-height:44px; margin:0 0 10px; padding:6px 10px; border:0; border-radius:8px; background:transparent; color:#276b2e; font:inherit; font-size:.875rem; font-weight:700; text-align:left; }
.ux-back:hover { background:#e8f4e5; }
.eyebrow { font-size: .75rem; color: #406d43; }
.sub { font-size: .875rem; color: #59665d; line-height: 1.45; }
.demo, .side-note { font-size: .75rem; color: #59675d; line-height: 1.5; }
.demo-card p, .demo-card li, .panel p, .section-note { font-size: .875rem; }
.section-note { line-height: 1.5; overflow-wrap: anywhere; }
.demo-card h2, .demo-table h2, .panel h2 { font-size: 1.125rem; }
.field .label, .label { font-size: .8125rem; color: #58655b; line-height: 1.35; }
.field .value, .value { font-size: .9375rem; line-height: 1.4; overflow-wrap: anywhere; }
.field { min-width: 0; }
.kv2 {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 12px;
  font-size: .875rem;
  align-items: start;
}
.kv2 span, .kv2 b { min-width: 0; overflow-wrap: anywhere; }
.kv2 span { color: #59675d; }
.stat small { font-size: .8125rem; }
.stat { min-width:0; }
.stat strong, .stat small { overflow-wrap:anywhere; }
.step, .pill2, .table-tabs a { font-size: .8125rem; }
.steps button.step { min-height:44px; cursor:pointer; }
.steps button.step:hover { border-color:#80ba74; background:#f4faf2; }
.btn { min-height: 44px; font-size: .875rem; }
.seg button { min-height: 40px; font-size: .8125rem; }
.legend span { font-size: .75rem; }
.weekdays div { color: #59665d; font-size: .75rem; }
.event small { color: #526357; }
.mobile-brand { display: none; }
.nav { gap: 15px; }
.nav-group { display: grid; gap: 3px; }
.nav-heading {
  color: #657269;
  font-size: .6875rem;
  font-weight: 750;
  letter-spacing: .08em;
  padding: 0 12px 5px;
  text-transform: uppercase;
}
.nav button { display: flex; align-items: center; min-height: 43px; font-size: .875rem; }
.nav button span:first-child { flex: 0 0 28px; width: 28px; font-size: 1rem; }
.nav button .text {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  font-size: .875rem;
  line-height: 1.25;
  overflow-wrap: normal;
}
.more-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.more-group { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.more-group h2 { margin: 0 0 8px; font-size: 1.125rem; }
.more-row {
  width: 100%;
  min-height: 48px;
  padding: 10px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #26352b;
  text-align: left;
  font-size: .9375rem;
}
.more-row:last-child { border-bottom: 0; }
.more-row:hover { color: #246b2a; }
.more-row span:last-child { font-size: 1.5rem; color: #4c6950; }

/* The calendar keeps the full grid on desktop. A compact date picker and agenda serve phones. */
.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #26352b;
  padding: 0;
  cursor: pointer;
}
.calendar-day .date { pointer-events: none; }
.month .event {
  min-height: 42px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: .75rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.month .event small { font-size: .6875rem; line-height: 1.25; }
.day-dots { display: flex; gap: 3px; margin-left: 4px; }
.day-dots i { width: 5px; height: 5px; border-radius: 50%; }
.day-dots .sid { background: #39823a; }
.day-dots .pri { background: #607ec0; }
.day-dots .bon { background: #bb7838; }
.day-dots .gor { background: #90619a; }
.agenda-list, .day-mobile { display: none; }
.month + .agenda-list.revealed { display: block; margin-top: 20px; }
.agenda-list { scroll-margin-top: 70px; }
.more {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  min-height: 34px;
}
.more:hover { color: #225e29; text-decoration: underline; }
.agenda-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}
.agenda-heading h2 { font-size: 1.125rem; margin: 2px 0 0; }
.agenda-kicker { color: #59675d; font-size: .75rem; }
.agenda-count { color: #526257; font-size: .8125rem; white-space: nowrap; }
.agenda-event {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-left: 4px solid #68ab55;
  border-radius: 11px;
  background: #fff;
  padding: 12px;
  text-align: left;
  color: #26352b;
  margin: 0 0 8px;
}
.agenda-event.pri { border-left-color: #7996d6; }
.agenda-event.bon { border-left-color: #c18543; }
.agenda-event.gor { border-left-color: #ad7bb7; }
.agenda-event:hover { background: #f8fbf7; }
.agenda-time { font-size: .8125rem; color: #526257; font-variant-numeric: tabular-nums; }
.agenda-copy { display: grid; gap: 2px; min-width: 0; }
.agenda-copy strong { font-size: .9375rem; font-weight: 700; overflow-wrap: anywhere; }
.agenda-copy small { color: #59675d; font-size: .8125rem; overflow-wrap: anywhere; }
.agenda-copy em { color: #a13a34; font-size: .75rem; font-style: normal; font-weight: 700; }
.agenda-chevron { color: #617168; font-size: 1.5rem; }
.empty-agenda { color: #59675d; font-size: .875rem; padding: 16px; background: #fff; border-radius: 10px; }

/* Data remains a sortable-looking table on wide screens and becomes complete records on compact widths. */
.demo-table table { font-size: .8125rem; }
.demo-table th { font-size: .75rem; color: #47564b; }
.record-list { display: none; }
.table-picker { display: none; }
.record-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 9px;
  overflow: hidden;
}
.record-card summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  padding: 14px;
  min-height: 72px;
}
.record-card summary::-webkit-details-marker { display: none; }
.record-main { display: grid; gap: 4px; min-width: 0; }
.record-main strong { font-size: .9375rem; overflow-wrap: anywhere; }
.record-main small { color: #59675d; font-size: .8125rem; overflow-wrap: anywhere; }
.record-value { display: grid; gap: 4px; justify-items: end; text-align: right; min-width: 0; }
.record-value small { color: #59675d; font-size: .75rem; }
.record-value strong { color: #225e29; font-size: .875rem; white-space: nowrap; }
.record-chevron { color: #637369; font-size: 1.125rem; transition: transform .2s ease; }
.record-card[open] .record-chevron { transform: rotate(180deg); }
.record-detail { padding: 0 14px 12px; }
.record-detail > div {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: .8125rem;
}
.record-detail span { color: #59675d; }
.record-detail strong { text-align: right; font-weight: 650; overflow-wrap: anywhere; }

@media (max-width: 980px) and (min-width: 701px) {
  .app { grid-template-columns: 190px minmax(0, 1fr); }
  .side { padding: 16px 8px; }
  .brand { justify-content: flex-start; }
  .brand strong, .nav button .text { display: block; }
  .nav button { text-align: left; padding: 9px 10px; }
  .nav button span:first-child { width: 26px; flex: 0 0 26px; }
  .nav-heading { padding-left: 10px; }
}

@media (max-width: 900px) {
  .table-tabs { display:none; }
  .table-picker { display:grid; gap:6px; margin-bottom:14px; color:#59675d; font-size:.8125rem; }
  .table-picker select { width:100%; min-width:0; min-height:48px; border:1px solid #cfdacf; border-radius:10px; background:#fff; color:#26352b; padding:10px 34px 10px 12px; font:inherit; font-size:.9375rem; }
  .demo-table { display: none; }
  .record-list { display: block; }
  .day-board { display: none; }
  .day-mobile { display: block; }
  .day-mobile .agenda-list { display: block; }
  .scroll-hint { display: none; }
  .cell { min-height: 55px; padding: 0; }
  .month .cell .event, .month .cell .more { display: none; }
  .calendar-day { width: 100%; min-height: 55px; padding: 5px 4px; align-items: center; }
  .calendar-day .date { font-size: .8125rem; }
  .cell.selected { background: #f0f7ef; }
  .cell.selected .date { background: #26742d; color: #fff; }
  .month + .agenda-list { display: block; margin-top: 20px; }
}

@media (max-width: 700px) {
  .app { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .topbar {
    height: calc(58px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-inline: 16px;
  }
  .mobile-brand { display: block; font-size: .9375rem; line-height: 1.1; }
  .mobile-brand small { display: block; color: #637168; font-size: .6875rem; font-weight: 500; margin-top: 3px; }
  .crumb, .mobile-select, .topbar .user { display: none; }
  .content { padding: 18px 12px 24px; }
  .screen-head h1, .heading h1 { font-size: clamp(24px, 1.5rem, 36px); line-height: 1.18; }
  .heading { margin-bottom: 16px; }
  .actions .btn { width: 100%; }
  .toolbar { gap: 12px; }
  .legend { gap: 5px; }
  .legend span { padding: 6px 8px; font-size: .6875rem; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(76px + env(safe-area-inset-bottom));
    padding: 4px 6px env(safe-area-inset-bottom);
    overflow: visible;
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    min-height: 68px;
    border-radius: 10px;
    color: #526257;
    font-size: .6875rem;
  }
  .mobile-nav button.active { color: #1f6827; background: #edf7eb; }
  .mobile-nav .tab-icon { font-size: 1.375rem; line-height: 1; }
  .mobile-nav button .text {
    display: block;
    width: auto;
    font-size: clamp(11px, .6875rem, 12px);
    line-height: 1.1;
    white-space: normal;
    overflow-wrap: anywhere;
    letter-spacing: -.02em;
  }
  .table-tabs { display: none; }
  .table-picker {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    color: #59675d;
    font-size: .8125rem;
  }
  .table-picker select {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    border: 1px solid #cfdacf;
    border-radius: 10px;
    background: #fff;
    color: #26352b;
    padding: 10px 34px 10px 12px;
    font: inherit;
    font-size: .9375rem;
  }
  .month { margin-inline: -6px; }
  .cell { min-height: 55px; padding: 0; }
  .month .cell .event, .month .cell .more { display: none; }
  .calendar-day { width: 100%; min-height: 55px; padding: 5px 4px; align-items: center; }
  .calendar-day .date { font-size: .8125rem; }
  .cell.selected { background: #f0f7ef; }
  .cell.selected .date { background: #26742d; color: #fff; }
  .day-dots { margin-left: 0; }
  .weekdays div { padding: 9px 1px; text-align: center; font-size: .6875rem; }
  .month + .agenda-list { display: block; margin-top: 20px; }
  .fields { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .field { min-height: 0; }
  .demo-layout, .detail { gap: 12px; }
  .demo-card, .panel { padding: 16px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .steps { gap: 6px; }
  .step { padding: 8px 10px; }
  .more-groups { grid-template-columns: 1fr; gap: 10px; }
  .more-group { padding: 15px; }
  .record-card summary { grid-template-columns: minmax(0, 1fr) minmax(70px, auto) 12px; gap: 6px; }
}

@media (max-width: 350px) {
  .content { padding-inline: 10px; }
  .month { margin-inline: -5px; }
  .agenda-event { grid-template-columns: 42px minmax(0, 1fr) 12px; gap: 7px; padding: 10px; }
  .record-value strong { white-space: normal; overflow-wrap: anywhere; }
  .stat-row { grid-template-columns:minmax(0,1fr); }
  .stat-row > .stat:last-child:nth-child(odd) { grid-column:auto; }
  .record-card summary { grid-template-columns:minmax(0,1fr) max-content; align-items:start; }
  .record-main { grid-column:1; grid-row:1; }
  .record-value { grid-column:1; grid-row:2; justify-items:start; text-align:left; }
  .record-chevron { grid-column:2; grid-row:1; }
}

@media (max-width: 400px) {
  .agenda-event { grid-template-columns:max-content minmax(0,1fr) max-content; }
  .agenda-time { white-space:nowrap; }
  .kv2 { grid-template-columns:minmax(0,1fr); gap:2px; }
  .kv2 b { text-align:left; }
  .record-card summary { grid-template-columns:minmax(0,1fr) minmax(0,.8fr) max-content; }
  .record-value strong { white-space:normal; overflow-wrap:anywhere; }
  .record-detail > div { grid-template-columns:minmax(0,1fr); gap:3px; }
  .record-detail strong { text-align:left; }
}

@media (max-width: 350px) {
  .record-card summary { grid-template-columns:minmax(0,1fr) max-content; }
}

@media (prefers-reduced-motion: reduce) {
  .record-chevron { transition: none; }
}
