/* v4 アプリスタイル */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1a1a1a;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-header {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #ddd;
  background: #f8f9fa;
}

.app-header--compact {
  padding: 0.45rem 1rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.version-tag {
  font-size: 0.85em;
  color: #2980b9;
}

.app-status {
  margin: 0;
  font-size: 0.875rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-status[data-tone="ok"] {
  color: #1f6f4a;
}

.app-status[data-tone="error"] {
  color: #c0392b;
}

.app-main {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

#appShell {
  --sidebar-panel-width: 360px;
}

.shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  gap: 0;
  padding: 16px;
  overflow: hidden;
  background: #eef2f6;
}

.shell-splitter {
  flex: 0 0 10px;
  width: 10px;
  margin: 0 6px;
  align-self: stretch;
  cursor: col-resize;
  touch-action: none;
  position: relative;
  z-index: 6;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 4px;
}

.shell-splitter:focus-visible {
  outline: 2px solid #1f6f4a;
  outline-offset: 2px;
}

.shell-splitter::after {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  border-radius: 2px;
  background: rgba(29, 35, 42, 0.14);
  transition: background 0.15s ease;
}

.shell-splitter:hover::after,
.shell-splitter.is-dragging::after {
  background: rgba(31, 111, 74, 0.45);
}

.dashboard-panel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  width: var(--sidebar-panel-width, 360px);
  min-width: 0;
  max-width: min(540px, 58vw);
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
}

.shell.sidebar-collapsed .dashboard-panel-container {
  flex: 0 0 0;
  width: 0 !important;
  max-width: 0 !important;
  min-width: 0 !important;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.shell.sidebar-collapsed .shell-splitter {
  flex: 0 0 14px !important;
  width: 14px !important;
  min-width: 14px !important;
  margin: 0 4px 0 0 !important;
  pointer-events: auto !important;
  z-index: 8;
}

.shell.sidebar-collapsed .shell-splitter::after {
  width: 4px;
  background: rgba(29, 35, 42, 0.24);
}

.side-panel.sidebar {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: none;
  background: transparent;
}

.sidebar-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 8px;
  padding-bottom: 20px;
  overflow-wrap: anywhere;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

.sidebar-content > * {
  flex-shrink: 0;
}

.sidebar .panel {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow: visible;
}

.sidebar .panel.form .primary-button {
  margin-bottom: 4px;
}

.sidebar .panel.hero {
  padding: 18px 18px 16px;
  background:
    linear-gradient(135deg, rgba(31, 111, 74, 0.14), rgba(200, 76, 59, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.75));
}

.sidebar .eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #1f6f4a;
  font-weight: 600;
  margin-bottom: 6px;
}

.sidebar .sidebar-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar .subtext {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}

.sidebar .panel.form {
  padding: 16px 18px;
}

.sidebar .panel-note {
  padding: 12px 16px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

.map-root {
  position: absolute;
  inset: 0;
  background: #e8ecef;
}

/* v3 feature-info-panel 相当：360×480 固定 */
.farm-control-panel {
  position: fixed;
  right: 16px;
  bottom: 30px;
  z-index: 1000;
  width: 360px !important;
  height: auto !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
  border-radius: 12px;
  border: none;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

.farm-control-panel--hidden {
  display: none !important;
}

.farm-control-panel__inner {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
}

.farm-control-panel__header--draggable {
  cursor: grab;
  user-select: none;
}

.farm-control-panel--dragging .farm-control-panel__header--draggable {
  cursor: grabbing;
}

.farm-control-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #1e293b;
  color: #fff;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.farm-control-panel__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.farm-control-panel__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.farm-control-panel__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* v3 安定版 integrated-mode-toolbar / panel-mode-btn */
.integrated-mode-toolbar {
  padding: 6px 10px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.integrated-mode-toolbar-label {
  font-size: 11px;
  font-weight: bold;
  color: #475569;
}

.panel-mode-buttons {
  display: flex;
  background-color: #e2e8f0;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
  width: 100%;
}

.panel-mode-btn {
  flex: 1;
  padding: 5px 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.panel-mode-btn.is-active {
  background-color: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-mode-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.panel-mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.farm-control-panel__content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 16px !important;
  background: rgba(255, 255, 255, 0.97) !important;
  border-radius: 0 0 12px 12px;
  font-size: 12px;
}

.farm-control-panel__content--plot {
  padding: 12px !important;
}

/* --- 団地モード（v3 integrated-danchi-records） --- */
.farm-control-panel .integrated-danchi-records {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.farm-control-panel .integrated-danchi-head {
  flex-shrink: 0;
}

.farm-control-panel .integrated-danchi-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 8px;
  min-width: 0;
}

.farm-control-panel .danchi-records-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.farm-control-panel .danchi-records-summary {
  padding: 10px 12px;
  margin-bottom: 6px;
  background-color: #fffbeb;
  border-bottom: 1px solid #fef3c7;
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 8px;
}

.farm-control-panel .danchi-records-summary__type {
  text-align: left;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.farm-control-panel .danchi-records-summary__count {
  text-align: center;
  white-space: nowrap;
}

.farm-control-panel .danchi-records-summary__area {
  text-align: right;
  white-space: nowrap;
}

.farm-control-panel .danchi-table-container {
  overflow-y: auto !important;
  overflow-x: auto;
  flex: 1 1 auto !important;
  min-height: 0;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.farm-control-panel .danchi-records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
  table-layout: fixed !important;
}

.farm-control-panel .danchi-records-table th {
  position: sticky !important;
  top: 0 !important;
  background-color: #f1f5f9 !important;
  padding: 8px 6px !important;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #cbd5e1;
  z-index: 2;
  box-shadow: 0 1px 0 #cbd5e1;
}

.farm-control-panel .danchi-records-table th:nth-child(1),
.farm-control-panel .danchi-records-table td:nth-child(1) {
  width: 9% !important;
  text-align: center;
  white-space: nowrap;
  color: #94a3b8;
}

.farm-control-panel .danchi-records-table th:nth-child(2),
.farm-control-panel .danchi-records-table td:nth-child(2) {
  width: 20% !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.farm-control-panel .danchi-records-table th:nth-child(3),
.farm-control-panel .danchi-records-table td:nth-child(3) {
  width: 25% !important;
  white-space: nowrap;
  text-align: right;
}

.farm-control-panel .danchi-records-table th:nth-child(4),
.farm-control-panel .danchi-records-table td:nth-child(4) {
  width: 46% !important;
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: break-all;
  line-height: 1.3;
  text-align: left;
}

.farm-control-panel .danchi-records-table.is-yuchi-table th:nth-child(3),
.farm-control-panel .danchi-records-table.is-yuchi-table td:nth-child(3) {
  width: 18% !important;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.farm-control-panel .danchi-records-table.is-yuchi-table th:nth-child(4),
.farm-control-panel .danchi-records-table.is-yuchi-table td:nth-child(4) {
  width: 20% !important;
  text-align: right;
}

.farm-control-panel .danchi-records-table.is-yuchi-table th:nth-child(5),
.farm-control-panel .danchi-records-table.is-yuchi-table td:nth-child(5) {
  width: 35% !important;
}

.farm-control-panel .danchi-records-table td {
  padding: 8px 6px !important;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.farm-control-panel .danchi-records-table tr:hover {
  background-color: #f8fafc;
}

.farm-control-panel .danchi-records-table tbody tr.danchi-record-row-hit {
  cursor: pointer;
}

.farm-control-panel .danchi-records-table tbody tr.danchi-record-row-hit.is-map-focus {
  background-color: rgba(254, 240, 138, 0.55) !important;
  box-shadow: inset 3px 0 0 #ca8a04;
}

.farm-control-panel .danchi-records-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.farm-control-panel .danchi-records-empty-msg {
  white-space: normal !important;
  text-align: center;
}

.farm-control-panel .danchi-records-empty-msg-inner {
  padding: 20px 8px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
}

/* --- 筆モード（v3 integrated-fude） --- */
.farm-control-panel .integrated-fude-panel-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.farm-control-panel .integrated-fude-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.farm-control-panel .feature-info-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.farm-control-panel .fude-main-info-section {
  margin-bottom: 8px;
}

.farm-control-panel .fude-main-info-heading {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px;
  padding: 0 0 2px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.farm-control-panel .feature-info-grid {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 2px 6px;
  align-items: center;
}

.farm-control-panel .feature-info-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.farm-control-panel .feature-info-value {
  font-size: 12px;
  color: #0f172a;
  word-break: break-word;
}

.farm-control-panel .feature-info-note {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 11px;
  color: #475569;
  margin: 4px 0 6px;
  line-height: 1.35;
}

.farm-control-panel .fude-adjust-section {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.farm-control-panel .fude-adjust-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.farm-control-panel .fude-action-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.farm-control-panel .feature-action-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.farm-control-panel .feature-action-btn:hover:not(:disabled) {
  background: #f1f5f9;
}

.farm-control-panel .feature-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.farm-control-panel .feature-action-btn.link {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.farm-control-panel .feature-action-btn.isolate {
  border-color: #fdba74;
  color: #c2410c;
  background: #fff7ed;
}

.farm-control-panel .feature-action-btn.link-cancel {
  flex: 0 1 auto;
  font-size: 10px;
  padding: 6px;
}

.farm-control-panel .fude-empty-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

.map-controls {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  left: auto;
  bottom: auto;
  z-index: 800;
  max-width: min(360px, calc(100% - 1.3rem));
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.18);
}

.map-controls--hidden {
  display: none;
}

.map-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.4rem;
}

.map-controls-row:last-child {
  margin-bottom: 0;
}

.map-controls-label {
  flex: 0 0 auto;
  min-width: 2.5rem;
  font-weight: 600;
  color: #444;
}

.map-controls-tab {
  padding: 0.25rem 0.55rem;
  font-size: 0.8125rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.map-controls-tab.is-active {
  color: #fff;
  background: #2980b9;
  border-color: #2980b9;
}

.map-controls-select {
  flex: 1 1 auto;
  min-width: 8rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.8125rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.map-controls-check {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-right: 0.35rem;
  cursor: pointer;
}

.map-controls-type-layers {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.map-controls-check--type {
  display: flex;
  width: 100%;
  margin-right: 0;
}

.system-status-bar {
  flex: 0 0 auto;
  min-height: 28px;
  background-color: #1e293b;
  color: #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 15px;
  font-size: 11px;
  border-top: 1px solid #334155;
  z-index: 2000;
  gap: 10px;
}

.system-status-bar .status-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.system-status-bar .license-area {
  opacity: 0.85;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.system-status-bar .brand-area {
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 12px;
  text-align: right;
}

.system-status-bar .status-bar-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.system-status-bar .status-bar-links button {
  background: transparent;
  border: none;
  color: #93c5fd;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.system-status-bar .status-bar-links button:hover {
  color: #dbeafe;
}

.compliance-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.compliance-modal-overlay.is-open {
  display: flex;
}

.compliance-modal-overlay[hidden] {
  display: none !important;
}

.compliance-modal {
  background: #fff;
  color: #1a1a1a;
  max-width: 640px;
  width: 100%;
  max-height: min(80vh, 720px);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compliance-modal header {
  padding: 14px 18px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compliance-modal header h2 {
  margin: 0;
  font-size: 16px;
}

.compliance-modal header button {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.compliance-modal .compliance-modal-body {
  padding: 14px 18px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
}

.compliance-modal .compliance-modal-body h3 {
  margin: 14px 0 6px;
  font-size: 14px;
}

.compliance-modal .compliance-modal-body ul {
  margin: 0 0 10px 1.2em;
  padding: 0;
}

.compliance-modal footer {
  padding: 10px 18px;
  border-top: 1px solid #ddd;
  text-align: right;
}

.compliance-modal footer button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #f5f5f5;
  cursor: pointer;
}

.sample-load-button {
  width: 100%;
  margin-bottom: 0.5rem;
}

.filter-exclusion {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  color: #5a4a00;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: 4px;
}

.filter-exclusion--prominent {
  border-width: 2px;
}

.filter-exclusion-meta {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: #444;
}

.plot-panel--compact {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.plot-panel-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  list-style-position: outside;
}

.plot-panel-body {
  margin-top: 0.5rem;
}

.panel-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.section-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
}

.panel-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: #666;
  line-height: 1.45;
}

.crs-block {
  margin: 0 0 1rem;
  padding: 0.75rem;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: 6px;
}

.crs-preview {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.8125rem;
  color: #444;
  line-height: 1.45;
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.panel-warn {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  color: #7d4e00;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: 4px;
}

.panel-summary {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.panel-meta {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: #444;
}

.drop-zone {
  padding: 1.25rem;
  text-align: center;
  border: 2px dashed #bbb;
  border-radius: 8px;
  background: #fafafa;
}

.drop-zone.is-dragover {
  border-color: #2980b9;
  background: #eef6fc;
}

.file-button {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  color: #fff;
  background: #2980b9;
  border-radius: 4px;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.field-select,
.field-input {
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.field-readonly {
  font-size: 0.875rem;
  padding: 0.35rem 0;
}

.primary-button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.55rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: #1f6f4a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button:hover {
  background: #185a3c;
}

.settings-block {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.stats-panel {
  margin-top: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.stat {
  background: #f4f8f5;
  border: 1px solid #d4e8dc;
  border-radius: 12px;
  padding: 12px;
}

.stat .label {
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
}

.stat .value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.stats-breakdown {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(29, 35, 42, 0.16);
  display: grid;
  gap: 6px;
}

.stats-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 0.35rem;
}

.stats-breakdown-label {
  color: #555;
}

.stats-breakdown-value {
  font-weight: 700;
  color: #24313b;
}

.stats-settings-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(29, 35, 42, 0.16);
  font-size: 0.6875rem;
  line-height: 1.45;
  color: #94a3b8;
}

.stats-settings-note__title {
  font-size: inherit;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 2px;
}

.stats-settings-note__line {
  margin: 0;
  font-size: inherit;
  font-weight: 400;
  color: #94a3b8;
}

.export-block__title {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 4px;
}

.panel-settings-details {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.panel-settings-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #444;
}

.export-block .button-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.export-block .secondary-button {
  width: 100%;
  margin-top: 0;
}

.map-controls-basemap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.map-controls-basemap__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.map-controls-basemap__label input {
  margin: 0;
  accent-color: #0f766e;
}

@media (max-width: 1080px) {
  .shell {
    flex-direction: column;
    padding: 8px;
  }

  .dashboard-panel-container {
    width: 100% !important;
    max-width: none !important;
    flex: 0 0 auto;
    max-height: 42vh;
  }

  .shell-splitter {
    display: none;
  }

  .side-panel.sidebar {
    max-height: 42vh;
  }
}

.farmer-legend {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

.farmer-legend__summary {
  cursor: pointer;
  font-weight: 600;
  color: #444;
}

.farmer-legend__list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 160px;
  overflow: auto;
}

.farmer-legend__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.farmer-legend__swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #999;
  border-radius: 3px;
  flex-shrink: 0;
}

.farmer-legend__more {
  color: #666;
  font-style: italic;
}

.stats-block {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f4f8f5;
  border: 1px solid #d4e8dc;
  border-radius: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
}

.stat-label {
  color: #555;
}

.stat-value {
  font-weight: 600;
}

.subsection-title {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #444;
}

.type-areas {
  margin-top: 0.35rem;
}

.plot-panel {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.secondary-button {
  padding: 0.4rem 0.65rem;
  font-size: 0.8125rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.secondary-button:hover {
  background: #f0f0f0;
}

.text-button {
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  border: none;
  background: transparent;
  color: #2980b9;
  cursor: pointer;
}

.export-block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

.export-block .secondary-button {
  display: block;
  width: 100%;
  margin-bottom: 0.4rem;
  text-align: left;
}

/* v3 相当：地図エリア内オーバーレイ（レイアウトを動かさない） */
.app-banners {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(560px, calc(100% - 2rem));
  pointer-events: none;
}

.app-banners:not([hidden]) {
  display: block;
}

.app-banners[hidden] {
  display: none !important;
}

.link-mode-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: #e67e22;
  border-radius: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.link-mode-banner__cancel {
  flex-shrink: 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  background: #fff;
  color: #e67e22;
  cursor: pointer;
}

.link-mode-banner__cancel:hover {
  background: #fff7ed;
}

.app-banners .spotlight-pickup-map-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #7c2d12;
  background: linear-gradient(180deg, #fffbeb 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 24px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  pointer-events: auto;
}

.spotlight-pickup-banner-dismiss {
  flex-shrink: 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid #ea580c;
  border-radius: 14px;
  background: #fff;
  color: #9a3412;
  cursor: pointer;
}

.spotlight-pickup-banner-dismiss:hover {
  background: #fff7ed;
}

.farm-control-panel .integrated-danchi-title-row .spotlight-btn {
  flex-shrink: 0;
  align-self: center;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.farm-control-panel .spotlight-btn {
  padding: 2px 5px;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.farm-control-panel .spotlight-btn:hover {
  background: #fff;
  border-color: #94a3b8;
}

.farm-control-panel .spotlight-btn.is-active {
  background: linear-gradient(180deg, #fff9e6 0%, #ffe8a8 100%);
  border-color: #f59e0b;
  color: #7c2d12;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.5), 0 2px 8px rgba(245, 158, 11, 0.35);
}

.farm-control-panel .spotlight-btn.spotlight-btn--picker-open {
  border-color: #ea580c;
  color: #9a3412;
}

.farm-control-panel .danchi-table-container.quick-picker-table-active .danchi-records-table > thead {
  display: none;
}

.farm-control-panel .quick-picker-scroll {
  position: relative;
  height: 300px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
}

.farm-control-panel .quick-picker-inner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

.farm-control-panel .quick-picker-item {
  cursor: pointer;
}

.farm-control-panel .quick-picker-inner-table tbody tr.quick-picker-item:is(:hover, .is-locked) td {
  background-color: rgba(255, 140, 0, 0.22);
}

.farm-control-panel .farmer-spotlight-danchi-panel {
  flex-shrink: 0;
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  max-height: 100px;
  overflow: auto;
}

.farm-control-panel .farmer-spotlight-danchi-title {
  font-size: 10px;
  font-weight: 800;
  color: #9a3412;
  margin: 0 0 4px;
}

.farm-control-panel .farmer-spotlight-danchi-list {
  margin: 0;
  padding: 0 0 0 14px;
  font-size: 10px;
}

.farm-control-panel .farmer-spotlight-danchi-hit {
  display: block;
  width: 100%;
  margin: 0 0 2px;
  padding: 3px 6px;
  text-align: left;
  font: inherit;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  cursor: pointer;
}

.farm-control-panel .farmer-spotlight-danchi-hit.is-selected {
  background: rgba(254, 249, 195, 0.98);
  border-color: #eab308;
}

.farm-control-panel .farmer-spotlight-danchi-meta {
  color: #b45309;
  font-weight: 700;
}

.farm-control-panel .danchi-records-table.is-spotlight-pickup-filtered tbody tr.danchi-record-row-hit {
  cursor: pointer;
}

path.farmer-spotlight-agg-path,
path.farmer-spotlight-outline-path,
path.farmer-spotlight-plot-path {
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 5px rgba(255, 214, 10, 0.95));
}

.danchi-custom-label.danchi-custom-label--spotlight-pickup .id-circle {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 2px solid #ea580c;
  font-size: 13px;
  font-weight: 900;
  min-width: 22px;
  height: 22px;
  line-height: 18px;
  padding: 0 6px;
  border-radius: 12px;
}

.danchi-custom-label.danchi-custom-label--spotlight-pickup .info-text {
  color: #0f172a;
  font-size: 11px;
  font-weight: 900;
}

.danchi-custom-label.danchi-custom-label--spotlight-pickup.is-pickup-target .id-circle {
  background: #ea580c;
  color: #fff;
  border: 2px solid #fff;
}

.danchi-custom-label.danchi-custom-label--spotlight-pickup.is-pickup-target .info-text {
  color: #fff;
  text-shadow: 0 0 3px #000;
}

.danchi-plots-block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

.danchi-plots-block--embedded {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.plot-table-wrap {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.plot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.plot-table th,
.plot-table td {
  padding: 0.35rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.plot-table th {
  position: sticky;
  top: 0;
  background: #f4f6f8;
  font-weight: 600;
  z-index: 1;
}

.plot-table-row {
  cursor: pointer;
}

.plot-table-row:hover {
  background: #eef6fc;
}

.plot-table-row.is-selected {
  background: #fdebd0;
  font-weight: 600;
}

.plot-table-row--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f5f5f5;
}

.plot-table-row--disabled:hover {
  background: #f5f5f5;
}

.plot-table-row:focus {
  outline: 2px solid #2980b9;
  outline-offset: -2px;
}

.panel-hint--compact {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

/* §8.5 団地ラベル（v3 安定版相当）— Leaflet divIcon の 12px 制限を解除 */
.leaflet-div-icon.danchi-label-leaflet-icon,
.leaflet-marker-icon.danchi-label-leaflet-icon {
  background: transparent !important;
  border: none !important;
  width: auto !important;
  height: auto !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
}

.danchi-custom-label {
  text-align: center;
  pointer-events: none;
  display: inline-block;
  transform: translate(-50%, -50%);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  white-space: nowrap;
  transition: transform 0.15s ease-out, filter 0.15s ease-out;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.35));
  -webkit-font-smoothing: antialiased;
}

.danchi-custom-label .id-circle {
  background-color: rgba(255, 255, 255, 0.98);
  border: 2px solid #0f172a;
  color: #0f172a;
  font-weight: 900;
  font-size: 12px;
  min-width: 22px;
  min-height: 22px;
  height: auto;
  border-radius: 14px;
  line-height: 18px;
  padding: 2px 6px;
  display: inline-block;
  margin-bottom: 3px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
}

.danchi-custom-label.danchi-custom-label--large-pending .id-circle {
  border-color: #ea580c;
  border-width: 2px;
  border-style: dashed;
}

.danchi-custom-label .info-text {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 5px #fff,
    0 0 4px #fff,
    0 0 3px #fff;
}

.danchi-custom-label.is-highlighted {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 3000;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.45));
}

.danchi-custom-label.is-highlighted .id-circle {
  border: 3.5px solid #facc15;
  background-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-weight: 900;
}

.danchi-custom-label.is-highlighted .info-text {
  color: #0f172a;
  font-weight: 800;
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 0 5px #fff,
    0 0 4px #fff;
}

/* E-03 オフライン版 — 背景地図なしの案内 */
.map-offline-notice {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(30, 41, 59, 0.92);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
