:root {
  color-scheme: light;
  --bg-base: #E9E0D2;
  --bg-surface: #F5F0E8;
  --bg-elevated: #EBE4D8;
  --bg-hover: #E2D9CB;
  --border-default: rgba(155, 135, 105, 0.22);
  --border-muted: rgba(155, 135, 105, 0.12);
  --text-primary: #2C2419;
  --text-secondary: #7D7264;
  --text-muted: #A69A8A;
  --accent: #BF6B3D;
  --accent-hover: #D47C4E;
  --accent-muted: rgba(191, 107, 61, 0.10);
  --success: #5B8C5A;
  --success-muted: rgba(91, 140, 90, 0.10);
  --warning: #C89234;
  --danger: #C04D48;

  /* spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --bottom-nav-height: 68px;

  /* type scale */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;

  /* radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "LXGW WenKai Mono Lite", system-ui, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-latin: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-numeric: "SF Pro Display", "SF Pro Text", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-password: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    sans-serif;
}

* { box-sizing: border-box; }

.ant-btn { box-shadow: none !important; }

html {
  min-height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

#root,
#login-root {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  input,
  textarea,
  select,
  .ant-input,
  .ant-input-affix-wrapper input.ant-input,
  .ant-select-selection-search-input,
  .ant-picker-input > input {
    font-size: 16px !important;
  }
}

/* ── scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #CABDAD; }

@keyframes emoji-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spin-refresh {
  to { transform: rotate(360deg); }
}

/* ── top bar ── */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-6) 12px;
  height: auto;
  min-height: 96px;
  background: rgba(235, 228, 216, 0.9);
  border-bottom: 1px solid var(--border-default);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--border-muted), 0 2px 12px rgba(100, 75, 45, 0.06);
}

.topbar-row-1 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 36px;
}

.topbar-row-2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding-top: 4px;
  border-top: 1px dashed var(--border-muted);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-lg);
  font-weight: 700;
  background: linear-gradient(90deg, #8B4A28, #BF6B3D, #D47C4E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-emoji {
  -webkit-text-fill-color: initial;
  font-size: 1.2em;
  display: inline-block;
  vertical-align: middle;
}

.stat-tiles {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
}

.stat-tile {
  flex: 1 1 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 28px !important;
  padding: 0 var(--sp-3) !important;
  border: 0 !important;
  border-right: 1px solid var(--border-muted) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
  position: relative;
  transition: color 0.15s, transform 0.15s;
}

.stat-tile:last-child {
  border-right: 0 !important;
}

.stat-tile:hover {
  background: transparent !important;
  color: var(--accent) !important;
}

.stat-tile:active {
  transform: translateY(1px);
}

.stat-tile:focus-visible {
  outline: 2px solid rgba(191, 107, 61, 0.30);
  outline-offset: 2px;
}

.stat-tile::after {
  content: "";
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 0.15s, transform 0.15s;
}

.stat-tile:hover::after {
  opacity: 0.85;
  transform: scaleX(1);
}

.stat-tile-value {
  color: var(--text-primary);
  font-family: var(--font-numeric);
  font-weight: 700;
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  line-height: 18px;
}

.stat-tile-label {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  line-height: 18px;
}

.stat-tile:hover .stat-tile-value,
.stat-tile:hover .stat-tile-label {
  color: var(--accent);
}

.stat-tile.has-alert .stat-tile-value,
.stat-tile.has-alert:hover .stat-tile-value {
  color: var(--danger);
}

.stat-tile.has-alert::after {
  background: var(--danger);
}

.stat-tile.has-alert::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(235, 228, 216, 0.95);
  animation: alert-dot-pulse 1.6s ease-in-out infinite;
}

@keyframes alert-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

/* ── body ── */
.app-body {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-6) calc(var(--sp-8) + var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

/* ── fixed bottom tab nav ── */
.app-body > .ant-tabs {
  display: block !important;
}

.app-body .ant-tabs-content-holder,
.app-body .ant-tabs-content,
.app-body .ant-tabs-tabpane {
  height: auto !important;
  overflow: visible !important;
}

.app-body .ant-tabs > .ant-tabs-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  z-index: 50;
  width: 100vw !important;
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  margin: 0 !important;
  padding: 4px max(var(--sp-6), calc(50vw - 550px)) 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, rgba(250, 247, 241, 0.92), rgba(232, 224, 212, 0.94));
  border-radius: 14px 14px 0 0;
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.62), 0 -10px 24px rgba(100, 75, 45, 0.10);
}

.app-body .ant-tabs > .ant-tabs-nav::before {
  display: none !important;
}

.app-body .ant-tabs-nav-wrap,
.app-body .ant-tabs-nav-list {
  width: 100%;
  align-items: stretch;
}

.app-body .ant-tabs-tab {
  flex: 1 1 0;
  justify-content: center;
  margin: 0 !important;
  padding: 6px var(--sp-2) 7px !important;
  transition: color 0.2s, background 0.2s;
}

.tab-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
  letter-spacing: 0;
}

.tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 19px;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.tab-name {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  transition: color 0.2s ease;
}

.app-body .ant-tabs-tab.ant-tabs-tab-active .tab-icon {
  color: var(--accent);
  background: rgba(191, 107, 61, 0.12);
  transform: translateY(-1px);
}

.app-body .ant-tabs-tab.ant-tabs-tab-active .tab-name {
  color: var(--accent);
}

.app-body .ant-tabs-tab:first-child {
  padding-left: 0 !important;
}

.app-body .ant-tabs-tab:last-child {
  padding-right: 0 !important;
}

.app-body .ant-tabs-tab:hover {
  background: rgba(255, 255, 255, 0.18);
}

.app-body .ant-tabs-tab-btn {
  width: 100%;
  text-align: center;
  font-size: var(--text-base);
  letter-spacing: 0.04em;
}

.app-body .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.app-body .ant-tabs-ink-bar {
  display: none !important;
}

/* ── loading ── */
.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: var(--text-md);
  letter-spacing: 0.04em;
}

/* ── planting ── */
.plant-panel {
  width: 100%;
}

.plant-card {
  border-color: var(--border-default) !important;
}

.plant-card .ant-card-body {
  padding: var(--sp-4) !important;
  min-height: calc(100dvh - 96px - var(--sp-6) - var(--bottom-nav-height) - var(--sp-8) - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.plant-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.plant-field-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
}

.plant-field-label {
  flex: 0 0 88px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.plant-field-control,
.plant-time-control,
.crop-picker-trigger,
.plant-duration-options {
  flex: 1 1 auto;
  min-width: 0;
}

.plant-time-control {
  display: flex !important;
}

.plant-time-control .ant-select {
  width: 50% !important;
}

.plant-duration-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.plant-duration-option,
.crop-picker-duration-tab {
  appearance: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 32px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.plant-duration-option.active,
.crop-picker-duration-tab.active {
  border-color: rgba(191, 107, 61, 0.42);
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 700;
}

.crop-picker-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.crop-picker-trigger:hover {
  border-color: rgba(191, 107, 61, 0.42);
  background: var(--accent-muted);
}

.crop-picker-trigger:disabled {
  cursor: not-allowed;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.crop-picker-trigger-emoji {
  font-family: var(--font-emoji);
  font-size: 20px;
  line-height: 1;
}

.crop-picker-trigger-placeholder {
  color: var(--text-muted);
}

.plant-timeline-section {
  margin-top: var(--sp-5);
  padding: var(--sp-4) 0 0;
  border: 0;
  border-top: 1px dashed var(--border-muted);
  border-radius: 0;
  background: transparent;
}

.plant-timeline-title {
  display: block;
  margin-bottom: var(--sp-3);
  padding: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.plant-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.plant-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: var(--sp-2);
  min-height: auto;
  padding: 10px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.plant-timeline-item:last-child {
  padding: 10px 0 0;
}

.plant-timeline-item::before,
.plant-timeline-item::after {
  content: "";
  position: absolute;
  top: 20px;
  height: 3px;
  background: var(--border-default);
}

.plant-timeline-item::before {
  left: 0;
  right: 50%;
}

.plant-timeline-item::after {
  left: 50%;
  right: 0;
}

.plant-timeline-item:first-child::before,
.plant-timeline-item:last-child::after {
  display: none;
}

.plant-timeline-dot {
  position: relative;
  z-index: 1;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 0;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--bg-surface);
}

.plant-timeline-item.water .plant-timeline-dot {
  border-color: #3F8FBF;
}

.plant-timeline-item.harvest .plant-timeline-dot {
  border-color: var(--success);
}

.plant-timeline-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.plant-timeline-stage {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.plant-timeline-time {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plant-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: auto;
  padding-top: var(--sp-6);
}

.crop-picker-duration-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.crop-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.crop-picker-tile {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 92px;
  padding: var(--sp-3) var(--sp-2);
  border: 1px solid rgba(191, 107, 61, 0.24);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.crop-picker-tile:hover,
.crop-picker-tile.active {
  border-color: rgba(191, 107, 61, 0.58);
  background: var(--accent-muted);
}

.crop-picker-tile:active {
  transform: scale(0.98);
}

.crop-picker-emoji {
  font-family: var(--font-emoji);
  font-size: 28px;
  line-height: 1;
}

.crop-icon-blueberry {
  position: relative;
  display: inline-block;
  width: 1.25em;
  height: 1em;
  font-family: inherit;
}

.crop-icon-blueberry span {
  position: absolute;
  width: 0.56em;
  height: 0.56em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #B9CCFF 0 10%, transparent 11%),
    radial-gradient(circle at 52% 46%, #2F5EB8 0 9%, transparent 10%),
    linear-gradient(145deg, #779AF2, #24489D);
  box-shadow: inset -0.05em -0.07em 0 rgba(32, 54, 120, 0.22);
}

.crop-icon-blueberry span:nth-child(1) {
  left: 0.08em;
  top: 0.18em;
}

.crop-icon-blueberry span:nth-child(2) {
  left: 0.48em;
  top: 0.04em;
}

.crop-icon-blueberry span:nth-child(3) {
  left: 0.58em;
  top: 0.42em;
}

.crop-picker-name {
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
}

.form-action-row { margin-top: var(--sp-3); }

/* ── empty state ── */
.empty-text-pad {
  display: block;
  padding: var(--sp-3) 0;
}

/* ── board ── */
.board-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
}

.board-list-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.board-row {
  padding: var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(100, 80, 50, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.board-row:hover {
  border-color: rgba(191, 107, 61, 0.28);
  box-shadow: 0 2px 8px rgba(191, 107, 61, 0.07);
}

.role-account-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}

.role-account-line-top {
  padding-bottom: var(--sp-2);
}

.role-progress-inline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1 1 auto;
  min-width: 0;
}

.role-name {
  display: block;
  flex: 0 1 auto;
  min-width: 52px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-crop-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  flex: 0 1 auto;
  margin-left: auto;
  max-width: 52%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: right;
}

.role-crop-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.role-crop-pill.idle {
  border: 0;
  background: transparent;
  color: var(--text-muted);
}

.role-crop-icon {
  font-family: var(--font-emoji);
  font-size: 16px;
  line-height: 1;
}

/* ── board timeline ── */
.board-stage-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  min-width: 0;
  padding-top: var(--sp-1);
}

.board-stage-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  text-align: center;
}

.board-stage-item::before,
.board-stage-item::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 50%;
  height: 3px;
  background: var(--border-default);
}

.board-stage-item::before {
  left: 0;
}

.board-stage-item::after {
  right: 0;
}

.board-stage-item:first-child::before,
.board-stage-item:last-child::after {
  display: none;
}

.board-stage-item.done::before,
.board-stage-item.done::after,
.board-stage-item.current::before {
  background: rgba(91, 140, 90, 0.42);
}

.board-stage-item.current::after,
.board-stage-item.waiting::before,
.board-stage-item.waiting::after {
  background: var(--border-default);
}

.board-stage-dot {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-default);
  border-radius: 50%;
  background: var(--bg-surface);
}

.board-stage-item.done .board-stage-dot {
  border-color: var(--success);
  background: var(--success);
}

.board-stage-item.current .board-stage-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-muted);
}

.board-stage-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
}

.board-stage-title {
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-stage-meta {
  color: var(--text-secondary);
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-stage-item.done .board-stage-title,
.board-stage-item.done .board-stage-meta {
  color: var(--success);
}

.board-stage-item.current .board-stage-title {
  color: var(--accent);
}

.board-stage-item.current .board-stage-meta {
  color: var(--accent);
  font-weight: 700;
}

.board-stage-item.waiting .board-stage-title,
.board-stage-item.waiting .board-stage-meta {
  color: var(--text-muted);
}

/* ── mobile-style list sections (待办 / 任务) ── */
.m-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.m-panel-tasks {
  height: calc(100vh - 96px - var(--sp-6) - var(--bottom-nav-height) - var(--sp-8) - env(safe-area-inset-bottom));
  height: calc(100dvh - 96px - var(--sp-6) - var(--bottom-nav-height) - var(--sp-8) - env(safe-area-inset-bottom));
  min-height: 360px;
}

.m-panel-tasks .m-section {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.m-panel-tasks .m-section-head {
  flex: 0 0 auto;
}

.m-panel-tasks .m-section-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.m-panel-tasks .m-section-list::-webkit-scrollbar {
  display: none;
}

.m-panel-tasks .m-section-empty {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-section {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(100, 80, 50, 0.04);
}

.m-section-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px var(--sp-4);
  background: linear-gradient(135deg, rgba(245, 240, 232, 0.95), rgba(235, 228, 216, 0.7));
  border-bottom: 1px solid var(--border-muted);
}

.m-section-emoji {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: rgba(255, 252, 247, 0.50);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.m-section-emoji .anticon {
  display: inline-flex;
}

.m-section-emoji.time-marker {
  border-color: rgba(63, 143, 191, 0.22);
  background: rgba(63, 143, 191, 0.08);
  color: #3F8FBF;
}

.m-section-emoji.alert-marker {
  border-color: rgba(192, 77, 72, 0.22);
  background: rgba(192, 77, 72, 0.08);
  color: var(--danger);
}

.m-section-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
}

.m-section-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.m-section-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.m-section-count {
  flex: 0 0 auto;
  min-width: 26px;
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: 11px;
  background: var(--accent-muted);
  color: var(--accent);
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.m-section-count.muted {
  background: var(--border-muted);
  color: var(--text-muted);
}

.m-section-list {
  list-style: none;
  margin: 0;
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.m-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding: 12px var(--sp-3);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 247, 0.62);
  transition: background 0.15s, border-color 0.15s;
}

.m-row:last-child { border-bottom: 1px solid var(--border-muted); }
.m-row:active { background: var(--accent-muted); }

.m-row-main {
  grid-column: 1 / -1;
  min-width: 0;
  display: contents;
}

.m-row-head {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.m-row-primary {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.m-row-badge {
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 52%;
  padding: 1px 6px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-numeric);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid var(--border-muted);
}

.m-row-badge.upcoming {
  background: transparent;
  color: #3F8FBF;
  border-color: rgba(63, 143, 191, 0.30);
}

.m-row-badge.overdue {
  background: transparent;
  color: var(--danger);
  border-color: rgba(192, 77, 72, 0.32);
}

.m-row-secondary {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-numeric);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.timing-account-title {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timing-action-chip {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  border: 1px solid transparent;
}

.timing-action-chip.water {
  background: rgba(63, 143, 191, 0.10);
  color: #3F8FBF;
  border-color: rgba(63, 143, 191, 0.22);
}

.timing-action-chip.harvest {
  background: var(--success-muted);
  color: var(--success);
  border-color: rgba(91, 140, 90, 0.24);
}

.timing-crop-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 0 1 auto;
  color: var(--text-secondary);
}

.timing-title-crop-icon {
  flex: 0 0 auto;
  font-family: var(--font-emoji);
  font-size: 14px;
  line-height: 1;
}

.timing-title-crop {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-row-secondary-stage {
  flex: 0 0 auto;
}

.m-row-crop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  color: var(--accent);
  font-weight: 700;
}

.m-row-crop-icon {
  flex: 0 0 auto;
  font-family: var(--font-emoji);
  font-size: 14px;
  line-height: 1;
}

.m-row-crop-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-row-action {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
}

.m-row.compact-action .m-row-head {
  grid-column: 1;
}

.m-row.compact-action .m-row-action {
  grid-row: 1;
}

.m-row-action .ant-btn {
  min-width: 82px;
  height: 32px;
  border-radius: 16px !important;
  font-size: var(--text-xs);
  padding: 0 var(--sp-3);
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(191, 107, 61, 0.18) !important;
}

.m-row-action .timing-complete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.m-row-action .timing-complete-btn:hover {
  border-color: var(--accent-hover) !important;
  background: var(--accent-hover) !important;
  color: #fff !important;
}

.m-row-action .timing-complete-btn:active {
  background: #A65A30 !important;
  border-color: #A65A30 !important;
}

.timing-waiting-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  height: 32px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.stat-modal-list {
  padding: 0;
}

.stat-modal .ant-modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default);
  box-shadow: 0 18px 48px rgba(80, 60, 30, 0.16) !important;
}

.stat-modal .ant-modal-header {
  background: var(--bg-surface) !important;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: var(--sp-3) !important;
  padding-bottom: var(--sp-3);
}

.stat-modal .ant-modal-title {
  color: var(--text-primary) !important;
}

.stat-modal .ant-modal-close {
  color: var(--text-secondary) !important;
}

.stat-modal .m-row {
  background: rgba(235, 228, 216, 0.56);
}

.theme-confirm-modal .ant-modal-content,
.theme-confirm-modal.ant-modal-confirm .ant-modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-default);
  box-shadow: 0 18px 48px rgba(80, 60, 30, 0.16) !important;
}

.theme-confirm-modal .ant-modal-confirm-title {
  color: var(--text-primary) !important;
  font-weight: 700;
}

.theme-confirm-modal .ant-modal-confirm-content {
  color: var(--text-secondary) !important;
}

.theme-confirm-modal .ant-modal-confirm-btns .ant-btn {
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
}

.theme-confirm-modal .ant-modal-confirm-btns .ant-btn-default {
  border-color: var(--border-default) !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
}

.theme-confirm-modal .ant-modal-confirm-btns .ant-btn-default:hover {
  border-color: rgba(191, 107, 61, 0.38) !important;
  color: var(--accent) !important;
}

.theme-confirm-modal .ant-modal-confirm-btns .ant-btn-primary {
  border-color: rgba(191, 107, 61, 0.22) !important;
  background: var(--accent-muted) !important;
  color: var(--accent) !important;
}

.theme-confirm-modal .ant-modal-confirm-btns .ant-btn-primary:hover {
  border-color: rgba(191, 107, 61, 0.55) !important;
  background: rgba(191, 107, 61, 0.18) !important;
}

.stat-modal-empty {
  padding: 24px var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.m-section-empty {
  padding: 28px var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

/* ── account management ── */
.accounts-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.account-create-strip {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 240, 232, 0.95), rgba(235, 228, 216, 0.85));
}

.account-create-copy {
  min-width: 0;
}

.account-section-title,
.account-section-subtitle {
  display: block;
}

.account-section-title {
  font-size: var(--text-md);
}

.account-section-subtitle {
  margin-top: 2px;
  font-size: var(--text-sm);
}

.account-create-control {
  width: min(48%, 320px);
  min-width: 220px;
  flex: 0 1 320px;
}

.account-list {
  display: grid;
  gap: var(--sp-3);
}

.account-card {
  padding: var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(100, 80, 50, 0.04);
}

.account-card-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  width: 100%;
}

.account-name-input {
  flex: 1 1 auto;
  max-width: 50%;
  min-width: 0;
}

.account-name-input.ant-input,
.managed-user-name-input.ant-input,
.managed-user-name-input.ant-input-affix-wrapper,
.managed-user-password-input.ant-input,
.managed-user-password-input.ant-input-affix-wrapper,
.account-create-control .ant-input,
.account-create-control .ant-input-affix-wrapper,
.managed-user-create-grid > .ant-input,
.managed-user-create-grid > .ant-input-affix-wrapper,
.managed-user-create-password .ant-input-affix-wrapper {
  height: 36px;
}

.account-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  flex: 0 0 auto;
}

.account-card-actions .ant-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
}

.account-create-control .ant-btn {
  width: 40px;
  height: 36px;
}

/* ── login screen ── */
.login-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 24px calc(40px + env(safe-area-inset-bottom));
  background:
    linear-gradient(118deg, rgba(23, 59, 51, 0.08) 0 18%, transparent 18% 100%),
    linear-gradient(154deg, transparent 0 58%, rgba(91, 140, 90, 0.14) 58% 100%),
    linear-gradient(180deg, #F7F3EA 0%, #EBF1E8 48%, #E6D8C9 100%);
  color: var(--text-primary);
  overflow: hidden;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  inset: auto -10% 0;
  height: 34%;
  background:
    repeating-linear-gradient(
      170deg,
      rgba(91, 140, 90, 0.18) 0 1px,
      transparent 1px 34px
    ),
    linear-gradient(180deg, transparent, rgba(91, 140, 90, 0.14));
}

.login-field-line {
  position: absolute;
  height: 1px;
  background: rgba(44, 36, 25, 0.08);
  transform: rotate(-18deg);
}

.login-field-line-1 {
  top: 18%;
  left: -12%;
  width: 62%;
}

.login-field-line-2 {
  top: 36%;
  right: -18%;
  width: 74%;
}

.login-field-line-3 {
  bottom: 20%;
  left: 10%;
  width: 88%;
}

.login-stage {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 20px;
}

.login-showcase {
  width: 100%;
  min-width: 0;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 14px;
  color: #F7F3EA;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #173B33;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 32px rgba(23, 59, 51, 0.24);
  font-size: 30px;
  line-height: 1;
}

.login-brand-kicker {
  margin: 0;
  font-size: 13px;
  color: #5F766A;
  letter-spacing: 0;
}

.login-brand-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
  background: linear-gradient(90deg, #8B4A28, #BF6B3D, #D47C4E);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0;
}

.login-farm-panel {
  position: relative;
  max-width: 100%;
  min-width: 0;
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(23, 59, 51, 0.96), rgba(35, 82, 63, 0.94)),
    #173B33;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 28px 54px rgba(23, 59, 51, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
  overflow: hidden;
}

.login-farm-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(255, 255, 255, 0.05) 49% 50%, transparent 50%),
    repeating-linear-gradient(0deg, transparent 0 44px, rgba(255, 255, 255, 0.04) 44px 45px);
  opacity: 0.75;
  pointer-events: none;
}

.login-farm-panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  color: #F7F3EA;
  font-weight: 700;
}

.login-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(121, 185, 116, 0.18);
  color: #CFEBC8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.login-farm-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.login-plot {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-plot-1 {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 10px),
    #5B8C5A;
}

.login-plot-2 {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.10) 0 1px, transparent 1px 12px),
    #C89234;
}

.login-plot-3 {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.10) 0 1px, transparent 1px 12px),
    #8A6A45;
}

.login-plot-4 {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    #36776D;
}

.login-task-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.login-task-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.login-task-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #173B33;
  background: #F7F3EA;
  font-size: 17px;
}

.login-task-row strong,
.login-task-row em {
  display: block;
  font-style: normal;
  letter-spacing: 0;
}

.login-task-row strong {
  color: #FFFFFF;
  font-size: 14px;
  line-height: 1.35;
}

.login-task-row em {
  margin-top: 2px;
  color: rgba(247, 243, 234, 0.66);
  font-size: 12px;
  line-height: 1.35;
}

.login-showcase-stats {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.login-showcase-stats span {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.74);
  color: #5F766A;
  box-shadow: 0 12px 30px rgba(44, 36, 25, 0.08);
}

.login-showcase-stats strong {
  color: #173B33;
  font-family: var(--font-numeric);
  font-size: 22px;
  line-height: 1;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  justify-self: center;
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 32px 70px rgba(44, 36, 25, 0.16),
    0 10px 26px rgba(23, 59, 51, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.login-card-body {
  padding: 32px 30px 28px;
}

.login-card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 24px;
}

.login-security-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #356F45;
  background: rgba(91, 140, 90, 0.12);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.login-card-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.22;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0;
}

.login-card-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-secondary);
  padding-left: 2px;
  margin-bottom: -4px;
}

.login-input.ant-input-affix-wrapper {
  min-height: 50px;
  padding: 0 15px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(155, 135, 105, 0.24) !important;
  background: #F7F3EA !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-input.ant-input-affix-wrapper:hover {
  border-color: rgba(191, 107, 61, 0.45) !important;
  background: #FFFBF3 !important;
}

.login-input.ant-input-affix-wrapper-focused,
.login-input.ant-input-affix-wrapper:focus-within {
  border-color: var(--accent) !important;
  background: #FFFFFF !important;
  box-shadow: 0 0 0 4px rgba(191, 107, 61, 0.16) !important;
}

.login-input .ant-input {
  background: transparent !important;
  color: var(--text-primary) !important;
  font-family: var(--font-password);
  font-size: 14px;
  letter-spacing: 0;
}

.login-input .ant-input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-latin);
  letter-spacing: 0;
}

.login-input .ant-input-prefix {
  margin-inline-end: 10px;
  color: var(--accent);
}

.login-input .ant-input-password-icon {
  color: var(--text-muted);
  transition: color 0.15s;
}

.login-input .ant-input-password-icon:hover {
  color: var(--accent);
}

.login-submit.ant-btn {
  height: 50px !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  letter-spacing: 0;
  font-size: 14px;
  background: linear-gradient(135deg, #C06A3C 0%, #173B33 100%) !important;
  border: none !important;
  color: #FFFFFF !important;
  box-shadow:
    0 14px 28px rgba(23, 59, 51, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  margin-top: 6px;
}

.login-submit.ant-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #D47C4E 0%, #23523F 100%) !important;
  box-shadow:
    0 16px 30px rgba(23, 59, 51, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  transform: translateY(-1px);
}

.login-submit.ant-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 8px 16px rgba(23, 59, 51, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
}

.login-submit-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-submit-content .anticon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.login-submit.ant-btn:hover:not(:disabled) .login-submit-content .anticon {
  transform: translateX(3px);
}

@media (max-width: 900px) {
  .login-screen {
    place-items: center;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
  }

  .login-stage {
    width: min(430px, 100%);
    max-width: calc(100vw - 36px);
    margin: 0 auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .login-showcase {
    min-height: auto;
    width: 100%;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
  }

  .login-brand-lockup {
    justify-content: flex-start;
  }

  .login-brand-title {
    font-size: 21px;
    line-height: 1.2;
  }

  .login-brand-kicker {
    font-size: 12px;
  }

  .login-farm-panel {
    padding: 16px;
  }

  .login-plot {
    min-height: 48px;
  }

  .login-card-body {
    padding: 28px 24px 24px;
  }

  .login-card {
    width: 100%;
    justify-self: center;
  }
}

@media (max-width: 520px) {
  .login-screen {
    padding: 20px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .login-stage {
    width: 100%;
    max-width: calc(100vw - 28px);
  }

  .login-brand-title {
    font-size: 20px;
  }

  .login-farm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .login-task-row {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 54px;
    padding: 9px 10px;
  }

  .login-task-icon {
    width: 34px;
    height: 34px;
  }

  .login-showcase-stats {
    gap: 8px;
  }

  .login-showcase-stats span {
    min-height: 64px;
    padding: 10px;
    font-size: 12px;
  }

  .login-showcase-stats strong {
    font-size: 20px;
  }

  .login-card-body {
    padding: 24px 18px 20px;
  }

  .login-card-header {
    gap: 8px;
    margin-bottom: 22px;
  }

  .login-card-title {
    font-size: 22px;
  }

  .login-card-subtitle {
    font-size: 12px;
    line-height: 1.5;
  }

  .login-input-label {
    font-size: 12px;
  }

  .login-input.ant-input-affix-wrapper,
  .login-submit.ant-btn {
    min-height: 48px;
    height: 48px !important;
  }
}

@media (max-width: 380px) {
  .login-brand-lockup {
    gap: 12px;
  }

  .login-brand-mark {
    width: 50px;
    height: 50px;
    font-size: 26px;
  }

  .login-brand-title {
    font-size: 18px;
  }

  .login-showcase-stats {
    grid-template-columns: 1fr;
  }

  .login-card-body {
    padding: 24px 18px 20px;
  }

  .login-card-title {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit-content .anticon {
    transition: none !important;
  }
}

/* ── responsive: tablet (≤ 960px) ── */
@media (max-width: 960px) {
  .app-body {
    padding: var(--sp-5) var(--sp-5) calc(var(--sp-6) + var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  .app-body .ant-tabs > .ant-tabs-nav {
    padding: 4px var(--sp-5) 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ── responsive: mobile (≤ 768px) ── */
@media (max-width: 768px) {
  .app-topbar {
    padding: 8px var(--sp-4) 10px;
    min-height: 86px;
    gap: var(--sp-2);
  }

  .topbar-brand { font-size: var(--text-md); }

  .stat-tile {
    padding: 0 var(--sp-2);
    gap: 5px;
  }

  .stat-tile-value { font-size: var(--text-base); }
  .stat-tile-label { font-size: 11px; }

  .app-body {
    padding: var(--sp-4) var(--sp-4) calc(var(--sp-6) + var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }

  .app-body .ant-tabs > .ant-tabs-nav {
    padding: 4px var(--sp-3) 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .m-panel-tasks {
    height: calc(100vh - 86px - var(--sp-4) - var(--bottom-nav-height) - var(--sp-6) - env(safe-area-inset-bottom));
    height: calc(100dvh - 86px - var(--sp-4) - var(--bottom-nav-height) - var(--sp-6) - env(safe-area-inset-bottom));
  }

  .role-progress-inline {
    flex: 1 1 auto;
    min-width: 0;
  }

  .board-row {
    padding: var(--sp-3);
  }

  .role-account-line {
    gap: var(--sp-2);
  }

  .role-name {
    max-width: 100%;
  }

  .role-crop-pill {
    max-width: 52%;
    padding: 0;
    font-size: var(--text-xs);
  }

  .board-stage-title {
    font-size: var(--text-xs);
  }

  .board-stage-meta {
    font-size: 11px;
  }

  .m-section-head {
    padding: 10px var(--sp-3);
    gap: var(--sp-2);
  }

  .m-section-emoji { font-size: 20px; }
  .m-section-title { font-size: var(--text-base); }

  .m-row {
    padding: 12px var(--sp-3);
    gap: var(--sp-2);
  }

  .m-row-action .ant-btn {
    min-width: 76px;
    padding: 0 var(--sp-2);
  }

  .plant-card .ant-card-body {
    padding: var(--sp-3) !important;
    min-height: calc(100dvh - 86px - var(--sp-4) - var(--bottom-nav-height) - var(--sp-6) - env(safe-area-inset-bottom));
  }

  .plant-field-row {
    gap: var(--sp-2);
  }

  .plant-form {
    gap: var(--sp-5);
  }

  .plant-field-label {
    flex-basis: 76px;
    font-size: var(--text-xs);
  }

  .plant-duration-options {
    gap: 6px;
  }

  .plant-duration-option {
    line-height: 30px;
  }

  .crop-picker-trigger {
    height: 38px;
    padding: 0 var(--sp-2);
  }

  .crop-picker-modal .ant-modal {
    max-width: calc(100vw - 32px);
  }

  .crop-picker-grid {
    gap: var(--sp-2);
  }

  .crop-picker-tile {
    min-height: 82px;
    padding: var(--sp-2);
  }

  .crop-picker-emoji {
    font-size: 24px;
  }

  .account-create-strip {
    gap: var(--sp-2);
    padding: var(--sp-3);
  }

  .account-create-control {
    width: min(60%, 280px);
    min-width: 200px;
    flex-basis: 280px;
  }

  .account-section-subtitle {
    display: none;
  }

  .account-card {
    padding: var(--sp-2);
  }

  .account-card-actions {
    gap: 4px;
  }
}

/* ── responsive: small mobile (≤ 480px) ── */
@media (max-width: 480px) {
  .account-create-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .account-create-copy {
    width: 100%;
  }

  .account-create-control {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* ── responsive: small mobile (≤ 400px) ── */
@media (max-width: 400px) {
  .app-topbar {
    min-height: 82px;
    padding: var(--sp-2) var(--sp-3) 10px;
  }

  .plant-field-label {
    flex-basis: 68px;
  }

  .plant-actions {
    gap: var(--sp-2);
  }

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

/* ── topbar avatar dropdown ── */
.topbar-avatar {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.topbar-avatar:hover {
  border-color: rgba(191, 107, 61, 0.55);
  background: var(--accent-muted);
}

.topbar-avatar:disabled {
  cursor: wait;
  opacity: 0.78;
}

.topbar-avatar:active { transform: scale(0.96); }

.topbar-avatar:focus-visible {
  outline: 2px solid rgba(191, 107, 61, 0.30);
  outline-offset: 2px;
}

.topbar-avatar .topbar-avatar-img {
  background: var(--accent-muted) !important;
  color: var(--accent) !important;
}

.user-menu-overlay .ant-dropdown-menu {
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  box-shadow: 0 12px 32px rgba(80, 60, 30, 0.14) !important;
  padding: 4px;
}

.user-menu-overlay .ant-dropdown-menu-item-divider {
  background: var(--border-muted);
}

.user-menu-overlay .ant-dropdown-menu-item {
  border-radius: var(--radius-sm);
}

.user-menu-overlay .ant-dropdown-menu-item-disabled {
  cursor: default !important;
}

.user-menu-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 160px;
  padding: 2px 0;
}

.user-menu-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.user-menu-tag {
  margin-inline-end: 0 !important;
}

/* ── managed user row (matches account-card style) ── */
.managed-user-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.managed-user-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-width: 0;
}

.managed-user-name-input,
.managed-user-password-input {
  flex: 1 1 auto;
  min-width: 0;
}

.managed-user-tags {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
  min-width: 110px;
}

.managed-user-tags .ant-tag {
  margin-inline-end: 0;
}

.managed-user-row-bottom .account-card-actions {
  flex: 0 0 110px;
  min-width: 110px;
}

.managed-user-password-input .ant-input {
  font-family: var(--font-password);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary) !important;
}

.managed-user-password-input .ant-input::placeholder,
.managed-user-create-password .ant-input::placeholder {
  font-family: var(--font-latin);
  letter-spacing: 0;
}

/* ── managed user create strip ── */
.managed-user-create-grid {
  display: grid;
  gap: var(--sp-2);
  flex: 1 1 auto;
  min-width: 0;
}

.managed-user-create-password {
  display: flex !important;
  width: 100%;
}

.managed-user-create-password .ant-input-affix-wrapper {
  flex: 1 1 auto;
}

.managed-user-create-password .ant-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 36px;
}

.managed-user-create-password .ant-input {
  font-family: var(--font-password);
  font-weight: 600;
  letter-spacing: 0.04em;
}

@media (min-width: 768px) {
  .managed-user-create-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
  }

  .account-create-strip.managed-user-strip {
    align-items: center;
  }
}

/* ── mail config strip ── */
.mail-config-strip .account-create-control {
  width: min(58%, 360px);
  min-width: 240px;
  flex: 0 1 360px;
}

.mail-config-strip .ant-input-affix-wrapper {
  align-items: center;
}

.mail-config-strip .ant-input-affix-wrapper .ant-input {
  height: auto;
  line-height: 20px;
}

.mail-config-strip .ant-input-prefix {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.mail-config-title-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.mail-config-help {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: help;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s, transform 0.15s;
}

.mail-config-help:hover,
.mail-config-help:focus-visible {
  color: var(--accent);
  outline: none;
}

.mail-config-help:active { transform: scale(0.92); }

.mail-config-tooltip { max-width: 280px; }

.mail-config-tooltip .ant-tooltip-inner {
  background: var(--text-primary) !important;
  color: var(--bg-surface) !important;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  line-height: 1.6;
  padding: 10px 12px !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 8px 22px rgba(60, 40, 20, 0.18) !important;
}

.mail-config-tooltip .ant-tooltip-arrow::before {
  background: var(--text-primary) !important;
}

@media (max-width: 480px) {
  .mail-config-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .mail-config-strip .account-create-control {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
}
