/* Shared visual system for the working application. */
:root {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: #20252d;
  background: #f7f8fa;
  --ink: #20252d;
  --muted: #66717e;
  --line: #e3e6ea;
  --green: #23634e;
  --light: #f0f5f2;
  --shadow: none;
}

body { min-width: 320px; }
h1 { font-size: 1.8rem; font-weight: 650; letter-spacing: -.04em; }
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.015em; }
h3 { font-size: .95rem; font-weight: 600; }
.hint, small { font-size: .8rem; }
.icon { width: 18px; height: 18px; stroke-width: 1.65; }
.card { border-color: var(--line); border-radius: 8px; box-shadow: none; }

.sidebar { width: 220px; padding: 28px 16px 20px; background: #f9fafb; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; }
.brand { margin: 0 8px; font-size: 1.35rem; gap: 10px; letter-spacing: -.04em; }
.brand img { width: 32px; height: 32px; }
.brand small { font-size: .7rem; font-weight: 400; letter-spacing: 0; margin-top: 3px; }
#menu-toggle { display: none; }
.sidebar #navigation { flex: 1; display: flex; flex-direction: column; gap: 5px; margin-top: 36px; min-height: 0; }
.sidebar #navigation button { min-height: 42px; padding: 10px 12px; gap: 11px; font-size: .88rem; font-weight: 450; border-radius: 6px; color: #596371; }
.sidebar #navigation button .icon { width: 18px; height: 18px; }
.sidebar #navigation button:hover { background: #edf0f2; }
.sidebar #navigation button.active { background: #e7efeb; color: #205a47; font-weight: 600; }
.sidebar #navigation .nav-settings { margin-top: auto; font-size: .8rem; }
.nav-count { background: transparent; color: #69737e; font-weight: 500; font-size: .75rem; }
.workspace { margin-left: 220px; }
.topbar { height: 58px; padding: 0 40px; background: #fff; font-size: .8rem; }
.topbar #crumb { color: #68717c; }
.connection { color: #68717c; font-size: .73rem; }
.status-dot { width: 5px; height: 5px; }
main { max-width: 1260px; padding: 32px 40px 40px; }
.page-heading { align-items: center; min-height: 40px; margin-bottom: 24px; gap: 20px; }
.page-heading h1 { margin: 0; }
.page-heading .management-actions { margin-top: 0; }

.button { min-height: 40px; border-radius: 6px; font-size: .85rem; padding: 9px 15px; gap: 7px; font-weight: 550; }
.button.secondary { color: #46515e; background: #fff; border-color: #dce0e5; }
.button.light { color: #354e43; background: #f4f7f5; border-color: #e0e7e2; }
.button.ghost { color: #596371; background: transparent; border-color: transparent; }
.button.ghost:hover { background: #edf0f2; filter: none; }
.button.small { min-height: 34px; font-size: .8rem; padding: 6px 11px; }
button:disabled { cursor: not-allowed; opacity: .45; }
.icon-button { width: 34px; height: 34px; border-color: transparent; color: #7b8490; background: transparent; }
.link-button { font-size: .8rem; font-weight: 500; }
.badge { padding: 4px 7px; background: #f1f3f5; color: #5f6975; font-size: .72rem; }

.field-label { justify-content: flex-start; gap: 4px; color: #505a67; font-size: .82rem; font-weight: 500; margin-bottom: 7px; }
.required { color: #7b8490; font-weight: 400; }
.fields { gap: 20px; }
input, select, textarea { min-height: 42px; padding: 10px 12px; border-color: #d9dee4; border-radius: 5px; color: var(--ink); background-color: #fff; font-size: .9rem; }
input::placeholder, textarea::placeholder { color: #929aa5; }
input:focus, select:focus, textarea:focus { border-color: #6c9481; outline: 3px solid #23634e0c; }
textarea { min-height: 180px; line-height: 1.65; }
input[type="checkbox"] { min-height: 0; padding: 0; }
.visit-info { padding: 22px 24px 24px; margin-bottom: 22px; }
.section-title { margin-bottom: 20px; gap: 8px; }
.section-title > .icon { display: none; }
.section-title h2 { color: #333c47; font-size: .9rem; }
.section-title small { color: #89919b; font-size: .72rem; }
.visit-info .fields { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 18px 20px; }
.visit-info .fields > .field:first-child { grid-column: span 2; }
.visit-info .fields > .field.full { grid-column: span 3; }
.visit-info input, .visit-info select { background-color: #fff; }
.crop-age { color: #808995; font-size: .72rem; margin-top: 5px; }
.add-first-producer { display: block; margin: 3px 0 -8px; padding: 3px 0; font-size: .76rem; }

.visit-content { overflow: hidden; }
.section-tabs { display: flex; align-items: stretch; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; }
.section-tabs button { position: relative; min-height: 54px; padding: 15px 0; border: 0; background: none; color: #717986; font-size: .88rem; white-space: nowrap; }
.section-tabs button[aria-selected="true"] { color: #202b25; font-weight: 600; }
.section-tabs button[aria-selected="true"]::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--green); }
.visit-content .tabs { flex-direction: row; gap: 8px; padding: 18px 24px 0; background: #fff; border: 0; border-radius: 0; overflow-x: auto; scrollbar-width: thin; }
.visit-content .tabs button { flex: 0 0 auto; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 5px; color: #6d7581; font-size: .8rem; font-weight: 400; white-space: nowrap; }
.visit-content .tabs button[aria-selected="true"] { background: #f0f2f4; color: #303a45; font-weight: 550; }
.visit-content .tabs button:hover { background: #f5f6f8; }
.tab-badge { min-width: 0; margin-left: 4px; font-size: .68rem; color: #79887e; }
.tab-badge:empty { display: none; }
.tab-panel { min-height: 270px; padding: 24px; }
.panel-header { margin-bottom: 18px; }
.panel-header h2 { font-size: .95rem; color: #39434f; }
.panel-header > .icon { display: none; }
.upload-zone { padding: 32px 20px; border-color: #dce0e5; background: #fafbfc; border-radius: 6px; }
.photo-symbol { background: transparent; color: #8a939d; width: 36px; height: 36px; margin-bottom: 8px; }
.upload-zone p { color: #7c8590; }
.measure-fields { margin-top: 0; gap: 20px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.measure-fields .field:last-child { grid-column: auto; }
.unit-input input { font-size: 1.15rem; min-height: 52px; }
.unit-input .unit { top: 16px; font-size: .8rem; color: #858e99; }
.measure-note { padding: 0; background: transparent; border: 0; color: #818a95; font-size: .76rem; margin-top: 22px; }
.measure-note .icon { display: none; }
.crop-block, .pdf-section { padding: 20px 0; border: 0; border-radius: 0; background: #fff; border-bottom: 1px solid var(--line); }
.crop-block:first-child { padding-top: 0; }
.crop-block h3 { font-size: .92rem; color: #39434f; }
.crop-sections { gap: 4px; padding: 0; border: 0; margin-bottom: 26px; }
.crop-result { border: 0; border-radius: 5px; background: #f5f7f6; padding: 14px 16px; }
.crop-result > span { color: #68746d; font-size: .82rem; }
.crop-result strong { color: #2c493b; font-size: 1.2rem; }
.crop-number-input > span { font-size: .75rem; color: #7f8792; }
.growth-chart { background: #fafbfc; border-color: var(--line); border-radius: 5px; }
.activity-edit, .question-card { background: #fff; border-color: var(--line); border-radius: 6px; padding: 18px; }
.activity-edit { border-left-width: 1px; }
.activity-edit-heading strong { color: #586270; font-weight: 550; }
.question-card textarea { min-height: 100px; }
.pdf-section > .hint { margin-bottom: 14px; }
.pdf-card { border-color: var(--line); border-radius: 6px; }
.savebar { bottom: 16px; min-height: 66px; margin-top: 20px; padding: 12px 20px; border-color: #dfe4e2; border-radius: 7px; box-shadow: 0 4px 18px #14251b07; }
.save-status { color: #69757f; font-size: .8rem; align-items: center; }
.save-status .icon { width: 16px; height: 16px; color: #81948a; margin-top: 0; }
.save-status small { color: #8c959e; font-size: .7rem; }

.stats { gap: 0; margin-bottom: 24px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.stat { padding: 18px 22px; border: 0; border-right: 1px solid var(--line); border-radius: 0; display: block; background: transparent; }
.stat:last-child { border-right: 0; }
.stat .icon { display: none; }
.stat strong { color: #303b47; font-size: 1.45rem; font-weight: 600; margin-bottom: 3px; }
.stat small { color: #7a8490; font-size: .76rem; }
.filters { padding: 18px 20px; border-radius: 7px; gap: 16px; }
.filters .field-label { font-size: .77rem; }
.filter-checkbox { font-size: .8rem; color: #6b7580; }
.visit-list { gap: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.visit-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 20px; gap: 20px; }
.visit-row:last-child { border-bottom: 0; }
.visit-row:hover { background: #fafbfc; }
.visit-date { color: #576675; }
.visit-detail h3 { font-size: .95rem; }
.visit-detail p { font-size: .82rem; }
.drafts h2 { font-size: .9rem; color: #626d7a; }
.empty-state { color: #858e99; padding: 50px 20px; }
.empty-state > .icon { width: 28px; height: 28px; color: #b0b9c0; }
.empty-state h2 { color: #6a7581; font-size: .98rem; }
.management-form, .producer-profile-card { padding: 24px; }
.management-form h2 { font-size: 1rem; }
.task-row { padding: 20px; border-radius: 6px; }
.task-check input { width: 19px; height: 19px; min-height: 0; margin-top: 2px; }
.task-detail h3 { font-size: .92rem; }
.task-detail p { font-size: .8rem; }
.profile-varieties { border: 0; padding: 0; }
.profile-varieties legend { padding: 0 0 10px; font-size: .82rem; color: #505a67; }
.profile-varieties input { width: 16px; height: 16px; min-height: 0; }
.producer-avatar { width: 38px; height: 38px; border-radius: 7px; background: #f0f2f4; color: #65717d; font-size: .85rem; }
.profile-title h2 { font-size: 1rem; }
.profile-title p, .producer-profile-card dl { font-size: .82rem; }
.profile-analysis-details summary { color: #5a6974; font-size: .82rem; font-weight: 450; }
.water-table { font-size: .82rem; }
.water-table thead th { background: #f5f6f8; color: #5d6875; font-size: .76rem; font-weight: 550; }
.water-table tr:nth-child(even) { background: #fcfcfd; }
.calendar-controls { background: #fff; max-width: none; padding: 20px; grid-template-columns: 1fr 220px; }
.calendar-toolbar h2 { font-size: 1.15rem; }
.calendar-type-filter { border-color: transparent; border-radius: 5px; font-size: .8rem; min-height: 34px; }
.calendar-type-filter[aria-pressed="true"] { border-color: #d8dedb; box-shadow: none; }
.calendar-table th { background: #f7f8fa; color: #717b88; font-size: .76rem; }
.calendar-day { min-height: 100px; }
.calendar-day.outside { background: #fbfcfd; }
.calendar-day-number { font-size: .83rem; }
.agenda-item { border-left-width: 2px; border-radius: 6px; }
.agenda-item-icon { width: 32px; height: 32px; background: transparent; }
.data-card { padding: 24px; }
.data-card > .icon { width: 22px; height: 22px; color: #76828d; margin-bottom: 16px; }
.data-card p { font-size: .85rem; margin-bottom: 0; }
.error-banner { background: #fff7f5; border-color: #f0ddd8; border-radius: 6px; }
.info-banner { background: #f5f7f8; color: #65727c; border-color: var(--line); border-radius: 6px; }
dialog { border-radius: 9px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar-actions .link-button { color: var(--muted); }
.topbar-actions .link-button:hover { color: var(--green); text-decoration: underline; }
.auth-screen .sidebar, .auth-screen .topbar { display: none; }
.auth-screen .workspace { margin: 0; }
.auth-screen main { min-height: 100dvh; display: grid; align-content: center; }
.login-form { width: min(100%, 400px); margin: 0 auto; padding: 34px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--muted); font-size: .88rem; }
.login-brand img { width: 32px; height: 32px; }
.login-form h1 { margin: 0 0 24px; font-size: 1.6rem; }
.login-fields { display: grid; gap: 17px; }
.login-form .button { width: 100%; margin-top: 22px; }
.login-form .error-banner { margin: 0 0 18px; }
#toast { left: calc(50% + 110px); font-size: .82rem; border-radius: 6px; background: #263c31; }

@media (max-width: 1100px) {
  .sidebar { width: 204px; padding-inline: 12px; }
  .workspace { margin-left: 204px; }
  main { padding: 28px; }
  .topbar { padding-inline: 28px; }
  .visit-info .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .visit-info .fields > .field:first-child { grid-column: auto; }
  .visit-info .fields > .field.full { grid-column: 1 / -1; }
  .page-heading { flex-wrap: wrap; gap: 12px; }
  #toast { left: calc(50% + 102px); }
}

@media (max-width: 800px) {
  .sidebar { position: relative; inset: auto; width: auto; display: block; padding: 16px 22px; background: #fff; }
  .sidebar-heading { min-height: 34px; }
  .brand { margin: 0; font-size: 1.25rem; }
  #menu-toggle { display: inline-flex; border: 1px solid var(--line); width: 36px; height: 36px; }
  .sidebar #navigation { display: none; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); overflow: visible; }
  .sidebar.nav-open #navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .sidebar #navigation button { min-width: 0; flex-direction: row; justify-content: flex-start; text-align: left; white-space: normal; min-height: 44px; font-size: .85rem; }
  .sidebar #navigation .nav-settings { margin-top: 0; }
  .sidebar #navigation button:last-child .icon { display: block; }
  .workspace { margin-left: 0; }
  .topbar { height: 42px; padding-inline: 22px; background: transparent; border: 0; }
  main { padding: 18px 22px 28px; }
  h1 { font-size: 1.6rem; }
  .page-heading { display: flex; margin-bottom: 20px; }
  .page-heading > .button { margin-top: 0; }
  .tab-panel { min-height: 260px; padding: 24px; }
  .visit-info .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .measure-fields { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .measure-fields.two-measures { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .savebar { bottom: 10px; }
  .save-actions > .button { display: inline-flex; }
  #toast { left: 50%; }
}

@media (max-width: 520px) {
  .sidebar { padding: 14px 16px; }
  .brand small { font-size: .65rem; }
  .topbar { padding-inline: 16px; font-size: .75rem; }
  main { padding: 16px 14px 24px; }
  h1 { font-size: 1.5rem; }
  .page-heading { gap: 12px; }
  .page-heading .button { font-size: .8rem; padding: 8px 11px; min-height: 38px; }
  .visit-heading-actions { width: 100%; justify-content: flex-start; gap: 4px; margin-top: 0; }
  .visit-heading-actions .button { padding: 5px 7px; min-height: 32px; font-size: .76rem; }
  .visit-info { padding: 18px; margin-bottom: 18px; }
  .section-title { margin-bottom: 18px; }
  .visit-info .fields { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px 12px; }
  .visit-info .fields > .field:first-child, .visit-info .fields > .field.full { grid-column: 1 / -1; }
  .visit-info .fields > .field:nth-child(4) { grid-column: 1 / -1; }
  .field-label { font-size: .79rem; }
  input, select, textarea { font-size: 16px; min-height: 44px; padding: 10px; }
  .section-tabs { padding: 0 14px; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .section-tabs button { min-height: 48px; font-size: .8rem; }
  .visit-content .tabs { padding: 14px 14px 0; gap: 5px; }
  .visit-content .tabs button { padding: 6px 8px; min-height: 34px; font-size: .78rem; }
  .tab-panel { padding: 20px 18px; min-height: 260px; }
  .tab-panel textarea { min-height: 190px; }
  .panel-header { margin-bottom: 16px; }
  .panel-header h2 { font-size: .92rem; }
  .upload-zone { padding: 24px 10px; }
  .upload-actions { flex-direction: column; align-items: stretch; }
  .upload-actions .button { min-height: 42px; }
  .measure-fields, .measure-fields.two-measures { grid-template-columns: 1fr; margin-top: 0; gap: 18px; }
  .unit-input input { min-height: 48px; font-size: 1.1rem; }
  .unit-input .unit { top: 14px; }
  .savebar { padding: 12px 14px; flex-wrap: wrap; gap: 10px; bottom: 8px; }
  .save-status { width: auto; flex: 1; min-width: 0; font-size: .73rem; }
  .save-status small { display: block; font-size: .66rem; }
  .save-actions { width: auto; }
  .save-actions > .button.primary { min-height: 40px; padding: 9px 12px; font-size: .8rem; }
  .save-actions .icon { display: none; }
  .stats { gap: 0; }
  .stat { padding: 14px 10px; }
  .stat strong { font-size: 1.3rem; }
  .stat small { font-size: .68rem; }
  .filters { padding: 16px; gap: 14px 12px; }
  .filters .search { flex-basis: 100%; }
  .filters .field { min-width: 110px; }
  .visit-row { padding: 16px 14px; gap: 12px; }
  .visit-tags { margin-left: 62px; }
  .producer-grid, .data-grid { grid-template-columns: minmax(0,1fr); }
  .management-form, .producer-profile-card { padding: 18px; }
  .management-form .fields { grid-template-columns: minmax(0,1fr); }
  .profile-varieties > div { gap: 12px; }
  .task-row { padding: 16px; }
  .calendar-controls { padding: 16px; gap: 16px; grid-template-columns: minmax(0,1fr); }
  .calendar-type-filter { font-size: .73rem; padding: 6px 8px; }
  .calendar-day { padding: 8px 4px; min-height: 76px; }
  .crop-block, .pdf-section { padding: 18px 0; }
  .crop-input-grid { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .question-card { padding: 14px; }
  .login-form { padding: 24px; }
  .topbar-actions { gap: 12px; }
}
