/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-main: #016833;
  --color-main-dark: #014d25;
  --color-main-light: #e8f5ee;
  --color-accent: #ff8948;
  --color-accent-light: #fff3ec;
  --color-sidebar-bg: #1a1a2e;
  --color-sidebar-text: #c8d6e5;
  --color-sidebar-hover: rgba(1, 104, 51, 0.3);
  --color-sidebar-active: #016833;
  --color-border: #e0e0e0;
  --color-table-header: #2d3436;
  --color-row-hover: #f5f9f7;
  --color-danger: #e74c3c;
  --color-warning: #f39c12;
  --color-success: #27ae60;
  --sidebar-width: 240px;
  --header-height: 56px;
  --font-jp: 'Noto Sans JP', sans-serif;
  --font-en: 'Gotham Narrow', 'Noto Sans JP', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.25s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-jp);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Loading Animation ===== */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-logo {
  margin-bottom: 32px;
  animation: logoFadeIn 0.8s ease forwards;
}

.loading-logo svg text {
  font-family: var(--font-jp);
}

@keyframes logoFadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading-tomato-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 32px;
}

.loading-tomato {
  width: 40px;
  height: 40px;
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  position: relative;
  animation: tomatoGrow 2.4s ease-in-out infinite;
}

.loading-tomato::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 10px;
  background: #27ae60;
  border-radius: 50% 50% 0 0;
  clip-path: polygon(20% 100%, 50% 0%, 80% 100%);
}

.loading-tomato:nth-child(1) {
  background: #2ecc71;
  animation-delay: 0s;
}
.loading-tomato:nth-child(2) {
  background: #f1c40f;
  animation-delay: 0.4s;
}
.loading-tomato:nth-child(3) {
  background: #e67e22;
  animation-delay: 0.8s;
}
.loading-tomato:nth-child(4) {
  background: #c0392b;
  animation-delay: 1.2s;
}
.loading-tomato:nth-child(5) {
  background: #e74c3c;
  animation-delay: 1.6s;
}

@keyframes tomatoGrow {
  0%, 100% { transform: scale(0.7) translateY(4px); opacity: 0.5; }
  50% { transform: scale(1.1) translateY(-4px); opacity: 1; }
}

.loading-text {
  font-size: 14px;
  color: var(--color-main);
  font-weight: 500;
  letter-spacing: 0.1em;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}

.loading-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--color-main), var(--color-accent));
  border-radius: 2px;
  animation: loadingBar 2s ease-in-out infinite;
}

@keyframes loadingBar {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* ===== App Layout ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow: hidden;
  box-shadow: 2px 0 8px rgba(0,0,0,0.05);
  transition: width .2s ease, box-shadow .2s ease;
}

.sidebar-logo {
  position: relative;
  flex-shrink: 0;
  padding: 8px 36px 6px 12px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.sidebar-logo-copy {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-main);
  letter-spacing: 0.02em;
}

.sidebar-logo img,
.sidebar-logo-mark {
  display: block;
  width: 108px;
  max-width: 100%;
  height: auto;
}

.sidebar-logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-main);
  line-height: 1.3;
}

.sidebar-user {
  padding: 0;
  flex-shrink: 0;
  border-bottom: none;
  font-size: 13px;
}

.sidebar-user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-main);
  color: #fff;
  padding: 10px 12px;
}

.sidebar-user-icon {
  display: flex;
  flex-shrink: 0;
}

.sidebar-user-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  margin: 0;
}

.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.sidebar-logout-btn:hover { opacity: 0.8; }

.sidebar-farm-picker {
  padding: 12px 14px 14px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #ececec;
}

.sidebar-farm-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #8a8a8a;
  margin-bottom: 8px;
}

.sidebar-farm-label svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar-farm-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f3f4f4;
  color: #333;
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 14px 16px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-main);
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-section-label .icon,
.sidebar-section-label svg {
  width: 13px;
  height: 13px;
  opacity: 0.8;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 22px;
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}

.sidebar-nav a .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.7;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-nav a .nav-icon svg {
  display: block;
}

.sidebar-nav a:hover {
  color: var(--color-accent);
  background: #fff8f3;
}

.sidebar-nav a.active {
  color: var(--color-accent);
  background: #fff3ec;
  font-weight: 700;
  border-right: 4px solid var(--color-accent);
}

.sidebar-nav a .nav-ext-icon {
  margin-left: auto;
  display: inline-flex;
  opacity: 0.55;
}

.sidebar-nav a .nav-ext-icon svg {
  width: 12px;
  height: 12px;
}

.sidebar-nav a:hover .nav-ext-icon,
.sidebar-nav a.active .nav-ext-icon {
  opacity: 0.9;
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: var(--sidebar-width);
  transform: translateY(-50%) translateX(-50%);
  background: var(--color-main);
  color: white;
  border: none;
  width: 20px;
  height: 40px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 10px;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cu-sidebar-collapse-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  color: var(--color-main);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.cu-sidebar-collapse-btn:hover {
  background: var(--color-main-light);
  border-color: var(--color-main);
}
.cu-sidebar-expand-btn {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 110;
  width: 22px;
  height: 48px;
  border: none;
  border-radius: 0 6px 6px 0;
  background: var(--color-main);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  box-shadow: 2px 0 8px rgba(1, 104, 51, 0.25);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cu-sidebar-expand-btn:hover { background: var(--color-main-dark); }
body.cu-sidebar-collapsed .cu-sidebar-expand-btn {
  display: flex;
}
body.cu-sidebar-collapsed .sidebar {
  width: 0;
  overflow: hidden;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
body.cu-sidebar-collapsed .main-content {
  margin-left: 0;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #eef1f0;
}

.page-header {
  background: var(--color-main);
  border-bottom: none;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title::before {
  content: '';
  width: 3px;
  height: 18px;
  background: #fff;
  border-radius: 1px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-body {
  padding: 24px;
  flex: 1;
  background: #eef1f0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-jp);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-main);
  color: white;
}

.btn-primary:hover {
  background: var(--color-main-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-accent {
  background: var(--color-accent);
  color: white;
}

.btn-accent:hover {
  background: #e87030;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f5f5f5;
  color: #444;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #eee;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-main);
  color: var(--color-main);
}

.btn-outline:hover {
  background: var(--color-main-light);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.btn-icon:hover {
  background: var(--color-main-light);
  border-color: var(--color-main);
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-jp);
  color: var(--color-text);
  transition: var(--transition);
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-main);
  box-shadow: 0 0 0 3px rgba(1, 104, 51, 0.1);
}

.form-control.error {
  border-color: var(--color-danger);
}

select.form-control {
  cursor: pointer;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar {
  background: #f9f9f9;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.filter-bar .form-inline {
  gap: 12px;
}

.panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px 16px;
  margin-bottom: 16px;
}
.panel-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}
.filter-panel { padding-top: 10px; }
.filter-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}
.filter-summary::-webkit-details-marker { display: none; }
.filter-summary::before {
  content: '▶';
  font-size: 10px;
  color: #6b7280;
  transition: transform .15s;
}
.filter-panel[open] .filter-summary { margin-bottom: 12px; }
.filter-panel[open] .filter-summary::before { transform: rotate(90deg); }
.filter-summary-meta {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}
.filter-block { margin-bottom: 14px; }
.filter-block:last-child { margin-bottom: 0; }
.filter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-main);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}
.filter-actions { display: flex; gap: 8px; }
.filter-panel > .filter-actions { margin-top: 12px; }

/* ===== Tables ===== */
.table-wrapper {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: var(--color-table-header);
  color: white;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.table th:first-child { border-radius: 0; }

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--color-row-hover);
}

.table-striped tr:nth-child(even) td {
  background: #fafafa;
}

/* ===== Badges & Status ===== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: var(--color-main-light); color: var(--color-main); }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: var(--color-success); }
.status-dot.red { background: var(--color-danger); }
.status-dot.yellow { background: var(--color-warning); }

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.card-body {
  padding: 16px;
}

/* ===== Dashboard Cards ===== */
.dashboard-card {
  background: #1e3d2f;
  border-radius: var(--radius-md);
  color: white;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.dashboard-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  transform: translate(20px, -20px);
}

.dashboard-card-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.dashboard-card-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
}

.work-type-badge {
  background: rgba(255, 137, 72, 0.3);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  display: inline-block;
}

.section-ab {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-block {
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.section-label {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}

.section-label-ab {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 6px;
}

.time-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-en);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.progress-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-en);
}

.progress-total {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: #444;
  border: 1px solid #ddd;
  transition: var(--transition);
}

.pagination a:hover {
  background: var(--color-main-light);
  border-color: var(--color-main);
  color: var(--color-main);
}

.pagination .active {
  background: var(--color-main);
  color: white;
  border-color: var(--color-main);
}

.pagination-info {
  font-size: 13px;
  color: #666;
  margin-right: 12px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover { color: var(--color-danger); background: #f5f5f5; }

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== Tags / Chips ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  transition: var(--transition);
}

.tag-default {
  background: white;
  border-color: #ccc;
  color: #555;
}

.tag-default:hover {
  border-color: var(--color-main);
  color: var(--color-main);
  background: var(--color-main-light);
}

.tag-active {
  background: var(--color-main);
  border-color: var(--color-main);
  color: white;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-family: var(--font-jp);
  font-weight: 500;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--color-main);
}

.tab-btn.active {
  color: var(--color-main);
  border-bottom-color: var(--color-main);
  font-weight: 600;
}

/* ===== Scroll Area ===== */
.scroll-x {
  overflow-x: auto;
}

.scroll-x::-webkit-scrollbar {
  height: 6px;
}

.scroll-x::-webkit-scrollbar-track { background: #f5f5f5; }
.scroll-x::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.scroll-x::-webkit-scrollbar-thumb:hover { background: var(--color-main); }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  body.cu-sidebar-collapsed .sidebar { width: 0; }
  body.cu-sidebar-collapsed .main-content { margin-left: 0; }
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start { display: flex; align-items: flex-start; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: #888; }
.text-main { color: var(--color-main); }
.text-accent { color: var(--color-accent); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.w-full { width: 100%; }

/* ===== Hover Underline Effect ===== */
.hover-underline {
  position: relative;
  text-decoration: none;
  color: var(--color-main);
  font-weight: 500;
}

.hover-underline::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -1px;
  left: 0;
  background: var(--color-main);
  transition: width 0.3s ease;
}

.hover-underline:hover::after {
  width: 100%;
}

/* ===== Section Header ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--color-main);
  border-radius: 2px;
}

/* ===== Chart Area ===== */
.chart-container {
  position: relative;
  width: 100%;
}

/* ===== Status Indicators ===== */
.indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--color-main);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .separator::before {
  content: '/';
}

/* ===== Dropdown ===== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}

.dropdown-item {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--color-main-light);
  color: var(--color-main);
}

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.alert-info { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid #f57c00; }
.alert-danger { background: #fce4ec; color: #b71c1c; border-left: 4px solid #c62828; }

/* ===== Timeline Chart ===== */
.timeline-chart {
  background: #d0d0c0;
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
}

.timeline-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.timeline-label {
  font-size: 12px;
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 500;
}

.timeline-track {
  flex: 1;
  height: 60px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.2);
}

.timeline-bar {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  background: #7bc67e;
  border-radius: 3px;
  border-right: 3px solid var(--color-accent);
}

.timeline-tick {
  position: absolute;
  top: 0;
  height: 100%;
  width: 1px;
  background: rgba(0,0,0,0.2);
}

/* ===== Pest Map ===== */
.pest-map-container {
  overflow-x: auto;
  background: #f9f9f9;
  border-radius: var(--radius-md);
  padding: 12px;
}

.pest-map-row {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
  align-items: center;
}

.pest-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid #ddd;
  background: white;
  flex-shrink: 0;
}

.pest-cell.disease { background: #e74c3c; border-color: #c0392b; }
.pest-cell.pest { background: #f39c12; border-color: #e67e22; }
.pest-cell.confirmed-3 { background: rgba(52, 152, 219, 0.3); border-color: #3498db; }
.pest-cell.confirmed-7 { background: rgba(52, 152, 219, 0.15); border-color: #3498db; }

/* ===== Checkbox ===== */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.checkbox-group input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--color-main);
}

/* ===== Print ===== */
@media print {
  .sidebar, .page-actions, .filter-bar { display: none; }
  .main-content { margin-left: 0; }
}

/* ===== Toast Notifications ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  font-size: 14px;
  font-family: var(--font-jp);
  font-weight: 500;
  min-width: 260px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.4);
  animation: toastProgress var(--toast-duration, 3s) linear forwards;
  border-radius: 0 0 10px 10px;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 80px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(60px) scale(0.92); max-height: 0; margin-bottom: -10px; }
}

.toast-success { background: #1a7a4a; color: white; }
.toast-error   { background: #c0392b; color: white; }
.toast-warning { background: #e67e22; color: white; }
.toast-info    { background: #2980b9; color: white; }

.toast-icon { font-size: 20px; flex-shrink: 0; }

.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 13px; line-height: 1.3; }
.toast-msg   { font-size: 12px; opacity: 0.88; margin-top: 2px; line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 16px;
  padding: 0 0 0 8px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.2s;
}
.toast-close:hover { color: white; }

/* ===== Confirm Dialog ===== */
#confirm-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9997;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
#confirm-overlay.show { display: flex; }

#confirm-box {
  background: white;
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  padding: 28px 32px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.25s ease;
}

.confirm-icon { font-size: 40px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: #1a1a1a; }
.confirm-msg { font-size: 14px; color: #555; margin-bottom: 24px; line-height: 1.6; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }
.confirm-btn { padding: 10px 28px; border-radius: 8px; font-size: 14px; font-family: var(--font-jp); font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; }
.confirm-btn-cancel { background: #f0f0f0; color: #555; }
.confirm-btn-cancel:hover { background: #e0e0e0; }
.confirm-btn-ok { background: var(--color-main); color: white; }
.confirm-btn-ok:hover { background: var(--color-main-dark); transform: translateY(-1px); }
.confirm-btn-ok.danger { background: #e74c3c; }
.confirm-btn-ok.danger:hover { background: #c0392b; }

/* ===== Loading Spinner (inline) ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ===== Form validation ===== */
.form-control.invalid {
  border-color: var(--color-danger) !important;
  background: #fff8f8;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.field-error-msg {
  font-size: 11px;
  color: var(--color-danger);
  margin-top: 4px;
}

/* ===== Login page ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #014d25 0%, #016833 40%, #028040 70%, #1a8a50 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}

.login-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  padding: 48px 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-mark {
  display: block;
  width: 168px;
  max-width: 70%;
  height: auto;
  margin: 0 auto;
}

.login-subtitle {
  font-size: 13px;
  color: #777;
  text-align: center;
  margin-bottom: 28px;
}

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

.login-field { position: relative; }

.login-field-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 16px;
  color: #aaa;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font-jp);
  color: var(--color-text);
  transition: all 0.2s;
  background: #fafafa;
}

.login-input:focus {
  outline: none;
  border-color: var(--color-main);
  background: white;
  box-shadow: 0 0 0 4px rgba(1,104,51,0.1);
}

.login-input.invalid {
  border-color: var(--color-danger);
  background: #fff8f8;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #016833, #028040);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-jp);
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(1,104,51,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(1,104,51,0.4);
}

.login-btn:active { transform: translateY(0); }

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: 20px;
}

.login-hint .hint-box {
  display: inline-block;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 8px 14px;
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}

.login-deco {
  position: absolute;
  opacity: 0.07;
  font-size: 120px;
  pointer-events: none;
}

/* ===== User menu in header ===== */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #d7efe3;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--font-jp);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-main);
  transition: all 0.2s;
}
.user-menu-btn:hover { background: #c5e6d6; }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-main);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
  animation: slideUp 0.15s ease;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-jp);
  text-align: left;
}
.user-dropdown-item:hover { background: #f5f5f5; }
.user-dropdown-item.danger { color: var(--color-danger); }
.user-dropdown-item.danger:hover { background: #fff0f0; }
.user-dropdown-divider { height: 1px; background: #f0f0f0; }
