@charset "UTF-8";

/* ==========================================================================
   農作業従事者向け 出勤・収穫管理Webアプリ
   【農家の温かみ & キュートな農園共通 UIデザインシステム】
   ========================================================================== */

:root {
  /* 農家風の配色システム (豊かな土・新緑・太陽の光・作物の実り) */
  --farm-soil-dark: #78350f;     /* 豊穣な大地の深みのある土色 */
  --farm-soil-mid: #92400e;      /* 暖かいテラコッタ・土色 */
  --farm-soil-light: #fef3c7;    /* やわらかな藁・麦わらカラー */

  --pea-primary: #16a34a;        /* みずみずしい農園グリーン */
  --pea-primary-hover: #15803d;  /* 深みのある畑の緑 */
  --pea-light: #f0fdf4;          /* 葉っぱのやわらかな背景 */
  --pea-pod-bg: #dcfce7;        /* サヤの明るいライトグリーン */
  --pea-dark: #14532d;           /* 濃密な新緑グリーン */
  
  --pea-accent: #86efac;         /* 若芽のアクセント */
  --farm-sun-yellow: #fef08a;   /* 太陽の陽だまりイエロー */
  --farm-sun-border: #fde047;

  --accent-amber: #d97706;       /* ぽかぽかビタミンオレンジ */
  --danger: #ef4444;             /* 摘み取りイチゴレッド */
  --danger-light: #fee2e2;

  --bg-main: #fdfbf7;            /* ナチュラル農園ナチュラルベージュ */
  --bg-card: #ffffff;
  --text-main: #292524;
  --text-muted: #57534e;
  --border-color: #e7e5e4;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Maru Gothic ProN", "メイリオ", sans-serif;
  --shadow-sm: 0 2px 6px rgba(120, 53, 15, 0.08);
  --shadow-md: 0 6px 16px rgba(22, 163, 74, 0.12);
  --shadow-lg: 0 12px 28px rgba(120, 53, 15, 0.18);
  
  /* サヤをイメージした丸み (Pill / Pod Curve) */
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-pod: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: radial-gradient(#86efac33 1px, transparent 1px), radial-gradient(#fef08a55 1px, #fdfbf7 1px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  color: var(--text-main);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.initial-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fdfbf7;
  color: #16a34a;
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  padding: 1.5rem;
}

/* スマホ最適化コンテナ */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 5.5rem;
}

/* ヘッダー - 農家風温かみヘッダー */
.app-header {
  background: linear-gradient(135deg, #ffffff 0%, #fef3c7 40%, #f0fdf4 100%);
  border-bottom: 3px solid #fde047;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--farm-soil-dark);
  text-decoration: none;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: white;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);
  transform: rotate(-4deg);
  font-size: 1.3rem;
  border: 2px solid #fde047;
}

/* ユーザー権限キュートバッジ */
.role-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-pod);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.role-badge.admin {
  background-color: var(--farm-sun-yellow);
  color: var(--farm-soil-dark);
  border: 2px solid var(--farm-sun-border);
}

.role-badge.employee {
  background-color: var(--pea-pod-bg);
  color: var(--pea-dark);
  border: 2px solid var(--pea-accent);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.active {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.status-badge.leave {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.status-badge.retired {
  color: #475569;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.bonus-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.bonus-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
}

.bonus-preview {
  display: grid;
  gap: 0.35rem;
  background: #fef3c7;
  border: 2px solid #fde047;
  padding: 0.9rem;
  border-radius: var(--radius-lg);
  font-weight: 800;
  color: var(--farm-soil-dark);
  margin-bottom: 1.25rem;
}

.settings-section-title {
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid #bbf7d0;
  color: var(--farm-soil-dark);
  font-size: 1.1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.compact-table .form-control {
  min-width: 7rem;
  padding: 0.45rem 0.55rem;
}

.compact-table .rule-description {
  min-width: 24rem;
}

.settings-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 1rem 0 0.25rem;
  background: linear-gradient(transparent, #fff 25%);
}

.kpi-sub {
  display: block;
  margin-top: 0.4rem;
  color: var(--farm-soil-mid);
  font-size: 0.78rem;
  font-weight: 800;
}

.kpi-person {
  font-size: 1.15rem;
  line-height: 1.35;
}

.kpi-empty {
  font-size: 1.05rem;
  color: var(--farm-soil-mid);
}

.mhp-kpi {
  background: linear-gradient(135deg, #fff7cc, #f0fdf4);
}

.ranking-explanation {
  margin: -0.35rem 0 1rem;
  color: var(--farm-soil-mid);
  font-size: 0.88rem;
  line-height: 1.65;
  font-weight: 700;
}

.ranking-list {
  display: grid;
  gap: 0.65rem;
}

.ranking-item {
  display: grid;
  grid-template-columns: 2.5rem minmax(8rem, 1fr) minmax(14rem, 1.5fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-lg);
  background: #fff;
}

.ranking-item.winner {
  border-color: #facc15;
  background: #fffbeb;
}

.ranking-position {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--pea-primary);
  color: #fff;
  font-weight: 900;
}

.ranking-person,
.ranking-score {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ranking-person small,
.ranking-score small {
  color: var(--farm-soil-mid);
  font-weight: 700;
}

.ranking-days {
  white-space: nowrap;
  font-weight: 800;
}

.ranking-badge {
  display: inline-flex;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.winner-badge { background: #facc15; color: #713f12; }
.eligible-badge { background: #dcfce7; color: #166534; }
.ineligible-badge { background: #fee2e2; color: #991b1b; }

.empty-state {
  padding: 1.25rem;
  text-align: center;
  color: var(--farm-soil-mid);
  background: #f8fafc;
  border-radius: var(--radius-lg);
  font-weight: 700;
}

@media (max-width: 640px) {
  .bonus-metrics,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .ranking-item {
    grid-template-columns: 2.25rem 1fr;
  }

  .ranking-score,
  .ranking-days,
  .ranking-item > div:last-child {
    grid-column: 2;
  }
}

/* ぷっくり農家風ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  border: 2px solid #86efac;
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.3);
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
  transform: translateY(-2px) scale(1.02);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--farm-soil-dark);
  border: 2px solid #fde047;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover, .btn-secondary:active {
  background-color: #fef3c7;
  transform: translateY(-1px);
}

.btn-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: 2px solid #fde047;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.25);
}

.btn-large {
  min-height: 3.5rem;
  font-size: 1.15rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-pod);
}

.btn:disabled, .btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* サヤ＆畑の土風キュートカード */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.35rem;
  border: 2px solid #bbf7d0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(to bottom, #16a34a, #f59e0b, #78350f);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--farm-soil-dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* フォームコントロール */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  color: var(--farm-soil-dark);
  margin-bottom: 0.5rem;
}

.form-label .required-tag {
  color: var(--danger);
  font-size: 0.75rem;
  background: var(--danger-light);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-pod);
  margin-left: 0.375rem;
  font-weight: bold;
}

.form-label .optional-tag {
  color: #15803d;
  font-size: 0.75rem;
  background: #dcfce7;
  border: 1px solid #86efac;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-pod);
  margin-left: 0.375rem;
  font-weight: bold;
}

.form-control {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: 2px solid #bbf7d0;
  border-radius: var(--radius-lg);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--pea-primary);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.2);
}

/* 切替タブボタン */
.tab-group {
  display: flex;
  background-color: #fef3c7;
  padding: 0.375rem;
  border-radius: var(--radius-pod);
  border: 2px solid #fde047;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  border-radius: var(--radius-pod);
  border: none;
  background: transparent;
  color: var(--farm-soil-dark);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #ffffff;
  color: #15803d;
  box-shadow: 0 4px 8px rgba(120, 53, 15, 0.12);
}

/* KPI 農家風カード */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: linear-gradient(135deg, #ffffff 0%, #fef3c7 40%, #f0fdf4 100%);
  border: 2px solid #fde047;
  border-radius: var(--radius-xl);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--farm-soil-dark);
  font-weight: 800;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--pea-primary-hover);
  margin-top: 0.25rem;
}

.kpi-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--farm-soil-mid);
  margin-left: 0.25rem;
}

/* ロック案内カード */
.lock-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #fde047;
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  color: var(--farm-soil-dark);
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* データテーブル */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 2px solid #bbf7d0;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  min-width: 900px;
}

.data-table th {
  background-color: #f0fdf4;
  color: var(--farm-soil-dark);
  font-weight: 800;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid #bbf7d0;
  white-space: nowrap;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f0fdf4;
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background-color: #fef3c7;
}

/* モーダル */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(120, 53, 15, 0.45);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  border-radius: 2rem;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  border: 3px solid #fde047;
  box-shadow: var(--shadow-lg);
}

/* ボトムナビゲーション */
.mobile-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #ffffff;
  border-top: 3px solid #fde047;
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0.25rem;
  z-index: 40;
  box-shadow: 0 -4px 12px rgba(120, 53, 15, 0.1);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--farm-soil-mid);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item.active {
  color: var(--pea-primary-hover);
  transform: translateY(-2px);
}

.nav-item svg {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.125rem;
}

/* ========================================================================== 
   v5 ポップ農園テーマ
   白い業務画面に見えすぎないよう、畑・空・太陽・野菜の色を画面全体へ展開。
   ========================================================================== */

:root {
  --farm-green: #2f8f4e;
  --farm-green-deep: #17643a;
  --farm-lime: #a8d65c;
  --farm-cream: #fffaf0;
  --farm-yellow: #ffd85c;
  --farm-orange: #ff9f43;
  --farm-pink: #ff7f83;
  --farm-sky: #dff3f1;
  --farm-ink: #3d342a;
  --farm-line: #dbe8c7;
  --shadow-sm: 0 5px 0 rgba(65, 91, 44, 0.07), 0 10px 24px rgba(83, 106, 58, 0.08);
  --shadow-md: 0 7px 0 rgba(49, 105, 57, 0.1), 0 16px 30px rgba(57, 105, 61, 0.13);
  --shadow-lg: 0 10px 0 rgba(75, 101, 50, 0.1), 0 24px 50px rgba(51, 88, 48, 0.18);
  --radius-lg: 1.15rem;
  --radius-xl: 1.75rem;
}

body {
  background-color: #fbf8e9;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(255, 216, 92, 0.23) 2px, transparent 2.5px),
    linear-gradient(180deg, rgba(223, 243, 241, 0.8) 0, rgba(255, 250, 240, 0.92) 290px, #fbf8e9 620px);
  background-size: 36px 36px, 100% 100%;
  color: var(--farm-ink);
  letter-spacing: 0.015em;
}

.app-container {
  max-width: none;
}

.main-content {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 1.6rem 1.25rem 2rem;
}

.app-header {
  background: rgba(255, 253, 244, 0.95);
  border-bottom: 0;
  box-shadow: 0 5px 22px rgba(55, 89, 45, 0.12);
  backdrop-filter: blur(14px);
}

.app-header::after {
  content: '';
  position: absolute;
  inset: auto 0 -7px;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--farm-green) 0 42px, var(--farm-lime) 42px 84px, var(--farm-yellow) 84px 126px, var(--farm-orange) 126px 168px);
}

.header-inner {
  min-height: 76px;
  padding: 0.7rem 1.25rem;
}

.brand-logo {
  gap: 0.8rem;
  color: var(--farm-green-deep);
}

.brand-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 48% 52% 46% 54%;
  background: linear-gradient(145deg, #78bf54, var(--farm-green));
  border: 3px solid #fff;
  box-shadow: 0 4px 0 #1e6d3c, 0 8px 16px rgba(31, 101, 57, 0.2);
  font-size: 1.5rem;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 1.18rem;
  letter-spacing: 0.08em;
}

.brand-copy small {
  margin-top: 0.28rem;
  color: #8a694d;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #4d6849;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}

.sync-badge i {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: #f2b84b;
}

.sync-badge.online i { background: #43a85f; }
.sync-badge.offline i,
.sync-badge.error i { background: #dc4c4c; }

.login-connection-error,
.account-security-note {
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  border-radius: 1rem;
  background: #fff0ec;
  border: 2px solid #f3b6a7;
  color: #8b382d;
  font-size: .86rem;
  font-weight: 800;
}

.role-badge {
  min-height: 2.7rem;
  padding: 0.45rem 1rem;
  background: #fff !important;
  font-size: 0.86rem;
  box-shadow: 0 4px 0 rgba(76, 94, 49, 0.1);
}

.role-badge.admin {
  border-color: var(--farm-yellow);
  color: #794a13;
  background: #fff8d9 !important;
}

.role-badge.employee {
  border-color: var(--farm-lime);
  color: var(--farm-green-deep);
  background: #f4fae9 !important;
}

.header-logout {
  min-height: 2.7rem;
  padding: 0.35rem 0.85rem;
  border-color: #f3c9b6;
  color: #8d4d32;
  font-size: 0.82rem;
}

.header-password {
  min-height: 2.7rem;
  padding: .35rem .7rem;
  border-color: #d5e6bc;
  color: #3f6b43;
  font-size: .78rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.3rem;
  padding: 1.35rem 1.5rem;
  background: linear-gradient(115deg, #eaf7d5, #fff5c7 64%, #ffe4c4);
  border: 2px solid #d5e7a7;
  border-radius: 2rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.page-heading::after {
  content: '🌱  🥕  🍅';
  position: absolute;
  right: 15%;
  bottom: -0.55rem;
  opacity: 0.22;
  font-size: 2.3rem;
  transform: rotate(-4deg);
}

.page-heading h2 {
  color: var(--farm-green-deep);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 900;
  line-height: 1.3;
}

.page-heading p {
  margin-top: 0.2rem;
  color: #795f47;
  font-size: 0.86rem;
  font-weight: 800;
}

.page-eyebrow,
.login-eyebrow {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--farm-green);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.month-picker {
  width: auto;
  min-width: 10.5rem;
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
}

.card {
  border: 2px solid var(--farm-line);
  border-radius: 1.75rem;
  padding: 1.55rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.card::before {
  width: 8px;
  background: repeating-linear-gradient(180deg, var(--farm-green) 0 34px, var(--farm-yellow) 34px 68px, var(--farm-orange) 68px 102px);
}

.card-title {
  color: var(--farm-green-deep);
  font-size: 1.18rem;
}

.kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.kpi-card {
  min-height: 160px;
  justify-content: center;
  padding: 1.25rem 1.35rem;
  border: 0;
  border-radius: 1.8rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-3px) rotate(-0.3deg);
  box-shadow: var(--shadow-lg);
}

.kpi-card::after {
  content: '';
  position: absolute;
  width: 92px;
  height: 92px;
  right: -30px;
  bottom: -36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
}

.mhp-kpi { background: linear-gradient(140deg, #fff7bd, #ffd968); }
.harvest-kpi { background: linear-gradient(140deg, #e3f6c3, #a8d65c); }
.time-kpi { background: linear-gradient(140deg, #dff5f2, #9eddd3); }

.kpi-decoration {
  position: absolute;
  right: 1.1rem;
  top: 0.8rem;
  font-size: 2rem;
  filter: drop-shadow(0 3px 0 rgba(255,255,255,.5));
  transform: rotate(8deg);
}

.kpi-label {
  color: #684b2f;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}

.kpi-value {
  color: var(--farm-green-deep);
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.kpi-person { font-size: clamp(1.2rem, 2.2vw, 1.55rem); }
.kpi-time { font-size: clamp(1.25rem, 2.4vw, 1.65rem); }
.kpi-sub { color: #735a42; }

.ranking-card {
  background: linear-gradient(150deg, #ffffff, #fffdf2);
}

.ranking-item {
  border-color: #e1eccd;
  border-radius: 1.35rem;
  background: #fbfff6;
  transition: transform .18s ease, border-color .18s ease;
}

.ranking-item:hover { transform: translateX(3px); border-color: var(--farm-lime); }
.ranking-item.winner { border-color: var(--farm-yellow); background: #fff8d6; }
.ranking-position { background: var(--farm-green); box-shadow: 0 3px 0 var(--farm-green-deep); }

.form-label { color: #604932; }

.form-control {
  border-color: #cfe1b6;
  border-radius: 1rem;
  background: #fffef9;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.form-control:hover { border-color: var(--farm-lime); }
.form-control:focus { border-color: var(--farm-green); box-shadow: 0 0 0 4px rgba(168, 214, 92, .27); }

.btn {
  border-radius: 1rem;
  box-shadow: 0 4px 0 rgba(71, 78, 46, 0.14);
}

.btn-primary {
  background: linear-gradient(145deg, #55ae5f, var(--farm-green));
  border-color: #7acb77;
  box-shadow: 0 5px 0 #17643a, 0 10px 18px rgba(47, 143, 78, .19);
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(145deg, #459f55, #217541);
  box-shadow: 0 3px 0 #155b36, 0 7px 14px rgba(47, 143, 78, .2);
}

.btn-secondary { border-color: #dccdae; background: #fffdf7; }
.btn-amber { background: linear-gradient(145deg, #ffba4d, #ee8e2b); border-color: #ffd06f; box-shadow: 0 5px 0 #b96519; }

.tab-group { background: #eff7df; border-color: #d3e5b3; }
.tab-btn.active { color: var(--farm-green-deep); box-shadow: 0 3px 0 rgba(70, 105, 45, .12); }

.table-responsive {
  border-color: #d6e5c2;
  border-radius: 1.25rem;
}

.data-table th {
  background: #edf7df;
  color: #4e6336;
  border-bottom-color: #cfe2ae;
}

.data-table tbody tr:nth-child(even) { background: #fffdf7; }
.data-table tbody tr:hover { background: #fff4c8; }

.mobile-nav {
  left: 50%;
  right: auto;
  bottom: 0.75rem;
  width: min(calc(100% - 1rem), 760px);
  transform: translateX(-50%);
  padding: 0.45rem;
  background: rgba(255, 253, 246, .96);
  border: 2px solid #d9e7c6;
  border-radius: 1.5rem;
  box-shadow: 0 8px 30px rgba(49, 83, 43, .2);
  backdrop-filter: blur(14px);
}

.nav-item {
  flex: 1;
  min-height: 3.2rem;
  border-radius: 1rem;
  color: #816d57;
}

.nav-item.active {
  color: var(--farm-green-deep);
  background: #e9f6d6;
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px #cce3a6;
}

.employee-nav .nav-item {
  display: grid;
  grid-template-rows: 1.7rem 1.35rem;
  place-items: center;
  align-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  line-height: 1;
}

.employee-nav .nav-icon {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
}

.employee-nav .nav-icon svg {
  width: 1.45rem;
  height: 1.45rem;
  margin: 0;
  display: block;
}

.employee-nav .nav-label {
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

.harvest-metric-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .35rem;
  position: relative;
  z-index: 1;
}

.harvest-metric-row {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  color: var(--farm-green-deep);
}

.harvest-metric-row strong { font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.05; }
.harvest-metric-row span { color: #8a4b18; font-size: .9rem; font-weight: 900; }

.employee-report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.employee-report-actions { display: flex; align-items: flex-start; justify-content: flex-end; gap: .75rem; margin-left: auto; }
.employee-report-actions .month-picker { flex: 0 0 auto; }
.employee-pdf-locked { display: flex; flex-direction: column; align-items: flex-end; }
.employee-pdf-locked span { margin-top: .2rem; color: #b45309; font-size: .75rem; font-weight: 800; }

.time-entry-panel { padding: 1rem; border: 2px solid #bbf7d0; border-radius: var(--radius-lg); background: #f0fdf4; }
.time-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.time-field-grid > div { min-width: 0; }
.time-field-grid .form-control { min-width: 0; }
.direct-time-fields { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.harvest-entry-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(6rem, 1fr); gap: .5rem; }
.harvest-entry-row > * { min-width: 0; }
.attendance-form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }
.native-time-control { display: block; width: 100%; min-width: 0; max-width: 100%; border: 2px solid #cfe1b6; border-radius: 1rem; background: #fffef9; overflow: hidden; }
.native-time-control:focus-within { border-color: var(--farm-green); box-shadow: 0 0 0 4px rgba(168, 214, 92, .27); }
.native-time-control > input.form-control { width: 100%; min-width: 0; max-width: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.native-time-control > input.form-control:focus { border: 0; box-shadow: none; }

.delete-confirm-modal { max-width: 460px; text-align: center; }
.delete-confirm-icon { font-size: 2.6rem; margin-bottom: .6rem; }
.delete-confirm-modal h3 { color: var(--farm-soil-dark); font-size: 1.3rem; margin-bottom: .6rem; }
.delete-confirm-modal p { color: #735a42; }
.delete-record-summary { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; padding: .85rem; border-radius: 1rem; background: #fff7df; font-weight: 900; }
.delete-note { color: var(--danger) !important; font-size: .82rem; font-weight: 800; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }

.shift-heading::after { content: '📅'; }
.shift-card { overflow: visible; }
.shift-controls { display: grid; grid-template-columns: repeat(2, minmax(180px, 260px)); gap: 1rem; margin-bottom: 1rem; }
.shift-controls label { display: grid; gap: .35rem; color: #604932; font-size: .85rem; font-weight: 900; }
.shift-guide { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0; padding: .9rem 1rem; border-radius: 1rem; background: #edf8dc; color: #315d36; }
.shift-guide span { font-size: .84rem; font-weight: 800; }
.shift-calendar { overflow-x: auto; padding-bottom: .25rem; }
.shift-weekdays, .shift-days { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); min-width: 900px; gap: .4rem; }
.shift-weekdays { margin-bottom: .4rem; }
.shift-weekdays > div { text-align: center; padding: .4rem; color: #70583f; font-size: .82rem; font-weight: 900; }
.shift-weekdays .saturday, .shift-day.saturday .shift-day-number { color: #2563a9; }
.shift-weekdays .sunday, .shift-day.sunday .shift-day-number { color: #c54343; }
.shift-day { min-height: 112px; padding: .55rem; border: 2px solid #dce9ca; border-radius: 1rem; background: #fffef9; position: relative; }
.shift-day.blank { border-color: transparent; background: transparent; }
.shift-day.outside-period { background: #f3f1eb; border-color: #ebe7dd; opacity: .55; }
.shift-day.selectable { display: flex; flex-direction: column; gap: .45rem; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.shift-day.selectable:hover { transform: translateY(-2px); border-color: #8fc75e; }
.shift-day.selectable.selected { color: #fff; background: linear-gradient(145deg, #60b86a, #2f8f4e); border-color: #287a43; box-shadow: 0 4px 0 #1e6638; }
.shift-day.selectable.selected .shift-day-number { color: #fff; }
.shift-day.selectable.locked { background: #f2f1eb; border-color: #dedbd1; box-shadow: none; }
.shift-day.selectable.locked:hover { transform: none; border-color: #dedbd1; }
.shift-day.selectable.locked .shift-day-number { color: #625d55; }
.shift-day.selectable.locked .shift-day-state { color: #645e55; background: #dedbd2; }
.shift-date-selector { display: flex; align-items: center; justify-content: space-between; gap: .35rem; cursor: pointer; }
.shift-day.locked .shift-date-selector { cursor: not-allowed; }
.shift-date-selector > input { position: absolute; opacity: 0; pointer-events: none; }
.shift-day-number { font-size: 1rem; font-weight: 1000; color: #554332; }
.shift-day-state { align-self: flex-end; padding: .18rem .5rem; border-radius: 999px; background: #edf8dc; color: #397345; font-size: .72rem; font-weight: 900; }
.shift-day.selected .shift-day-state { color: #24683d; background: #fff9cc; }
.shift-time-fields { display: none; gap: .25rem; flex-direction: column; padding-top: .25rem; border-top: 1px solid rgba(255,255,255,.45); }
.shift-time-fields.visible { display: flex; }
.shift-time-fields label { display: grid; grid-template-columns: 2.2rem 1fr; align-items: center; gap: .2rem; font-size: .64rem; font-weight: 900; }
.shift-time-input { width: 100%; min-width: 0; padding: .2rem .25rem; border: 1px solid #b9d6a0; border-radius: .4rem; background: #fff; color: #24593a; font-size: .7rem; font-weight: 800; }
.shift-time-input:disabled { color: #716d65; background: #e8e6df; }
.shift-day.admin-day { min-height: 120px; }
.shift-day.admin-day { width: 100%; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.shift-day.admin-day:hover { border-color: #83be62; transform: translateY(-2px); }
.shift-day.admin-day.timeline-selected { border-color: #277b45; box-shadow: 0 0 0 3px rgba(60, 164, 90, .2), 0 4px 0 #277b45; background: #f1fae8; }
.shift-name-list { display: flex; flex-direction: column; gap: .25rem; margin-top: .35rem; }
.shift-name-chip { display: flex; flex-direction: column; padding: .25rem .35rem; border-radius: .45rem; background: #dff3c6; color: #285d39; overflow: hidden; }
.shift-name-chip b { font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-name-chip small { color: #526b42; font-size: .62rem; font-weight: 800; }
.shift-none { color: #a19588; font-size: .68rem; }
.shift-note-field { margin-top: 1.25rem; }
.shift-submitted-status, .shift-not-submitted { margin: .75rem 0; padding: .65rem .8rem; border-radius: .8rem; font-size: .82rem; font-weight: 900; }
.shift-submitted-status { color: #22613a; background: #e4f6d5; }
.shift-not-submitted { color: #9a5a17; background: #fff3d1; }
.shift-submit-button { width: 100%; }
.shift-employee-list { display: flex; flex-direction: column; gap: .65rem; }
.shift-employee-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(180px, 2fr) auto auto; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 2px solid #dce9ca; border-radius: 1rem; background: #fffef9; }
.shift-employee-row > div:first-child { display: flex; flex-direction: column; }
.shift-employee-row small { color: #7e6b57; font-size: .75rem; }
.shift-request-detail { display: flex; flex-direction: column; gap: .15rem; }
.shift-request-detail > span { color: var(--farm-green-deep); font-weight: 900; }
.shift-request-detail em { color: #8b5d2d; font-size: .76rem; font-style: normal; }
.admin-confirmed-edit-guide { margin: -.25rem 0 1rem; color: #725f4e; font-size: .82rem; font-weight: 800; }
.admin-shift-edit-button { min-height: 2.4rem; padding: .4rem .7rem; font-size: .78rem; white-space: nowrap; }
.shift-window-notice, .shift-window-admin { margin-bottom: 1rem; padding: 1rem; border: 2px solid; border-radius: 1.1rem; }
.shift-window-notice { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.shift-window-notice.open, .shift-window-admin.open { color: #24653c; border-color: #86cc7c; background: #e8f8dc; }
.shift-window-notice.closed, .shift-window-admin.closed { color: #765f4c; border-color: #d7cdbf; background: #f4f1ea; }
.shift-window-notice span { font-size: .82rem; font-weight: 800; }
.shift-window-admin { display: grid; grid-template-columns: minmax(190px, 1fr) auto; align-items: center; gap: .75rem 1rem; }
.shift-window-admin > div:first-child { display: flex; flex-direction: column; }
.shift-window-admin > div:first-child span { font-size: .78rem; font-weight: 800; }
.shift-window-admin > small { grid-column: 1 / -1; font-weight: 800; }
.shift-window-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; padding: .25rem; border-radius: .8rem; background: rgba(255,255,255,.7); }
.shift-window-button { min-width: 86px; padding: .55rem .8rem; border: 2px solid transparent; border-radius: .65rem; background: transparent; color: #746655; font-weight: 1000; cursor: pointer; }
.shift-window-button.open.active { color: #fff; border-color: #257643; background: #329553; }
.shift-window-button.closed.active { color: #fff; border-color: #805e45; background: #927057; }
.confirmed-shift-note { margin-top: 1rem; padding: .8rem 1rem; border-radius: .9rem; color: #6d5c4e; background: #f3f0e8; font-size: .8rem; font-weight: 800; }
.own-shift-day { border-color: #178447 !important; background: #dcfce7 !important; box-shadow: inset 0 0 0 2px #53b86f, 0 3px 0 #178447 !important; }
.own-shift-day .shift-day-number { color: #126436 !important; }
.own-shift-legend { display: flex; align-items: center; gap: .45rem; margin: -.35rem 0 .9rem; color: #17643a; font-size: .8rem; font-weight: 900; }
.own-shift-legend > span { width: 1rem; height: 1rem; border: 2px solid #178447; border-radius: .3rem; background: #dcfce7; }
.shift-mobile-time-button { display: none; }

.daily-timeline-card { margin-top: 1.25rem; padding: 1rem; border: 2px solid #d7e7c3; border-radius: 1.2rem; background: linear-gradient(145deg, #fffef8, #f8fced); }
.daily-timeline-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.daily-timeline-heading span { color: #69924e; font-size: .68rem; font-weight: 1000; letter-spacing: .12em; }
.daily-timeline-heading h3 { margin: .1rem 0 0; color: var(--farm-green-deep); font-size: 1.05rem; }
.daily-timeline-heading small { color: #7a6a59; font-size: .72rem; font-weight: 800; }
.timeline-scroll { overflow-x: auto; padding: .25rem 0 .6rem; }
.timeline-chart { display: grid; grid-template-columns: 150px minmax(650px, 1fr); align-items: center; min-width: 800px; gap: .45rem 0; }
.timeline-axis-name { align-self: end; padding: 0 .75rem .55rem 0; color: #695844; font-size: .72rem; font-weight: 900; text-align: right; }
.timeline-axis { position: relative; height: 2rem; margin: 0 .8rem; border-bottom: 2px solid #a8bd92; }
.timeline-axis span { position: absolute; bottom: .35rem; color: #625849; font-size: .65rem; font-weight: 900; transform: translateX(-50%); white-space: nowrap; }
.timeline-axis span:first-child { transform: none; }
.timeline-axis span:last-child { transform: translateX(-100%); }
.timeline-person { display: flex; align-items: center; justify-content: flex-end; min-height: 2.65rem; padding-right: .75rem; border-right: 2px solid #b7caa1; }
.timeline-person strong { max-width: 135px; color: #4c4237; font-size: .76rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-track { position: relative; height: 2.65rem; margin: 0 .8rem; border-radius: .55rem; background: #eef3e7; overflow: hidden; }
.timeline-grid-lines { position: absolute; inset: 0; pointer-events: none; }
.timeline-grid-lines i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(91, 115, 72, .18); }
.timeline-bar { position: absolute; top: .38rem; bottom: .38rem; display: flex; align-items: center; justify-content: center; min-width: 42px; border: 2px solid #267944; border-radius: .5rem; background: linear-gradient(90deg, #3ca45a, #73c768); box-shadow: 0 3px 0 rgba(35, 102, 57, .25); color: #fff; overflow: hidden; }
.timeline-bar span { padding: 0 .4rem; font-size: .68rem; font-weight: 1000; white-space: nowrap; }
.timeline-bar.unset { border-color: #998b7c; background: repeating-linear-gradient(135deg, #b8afa4 0 8px, #a69b8f 8px 16px); }
.timeline-empty { padding: 1.4rem; border-radius: 1rem; color: #7b6e5e; background: #f3f1ea; font-weight: 800; text-align: center; }

.admin-shift-modal-backdrop { padding: 1.25rem; }
.admin-shift-edit-modal { width: min(1120px, 96vw); max-width: 1120px; max-height: 94vh; overflow-y: auto; text-align: left; }
.admin-shift-edit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 2px solid #d8e7c4; }
.admin-shift-edit-heading span { color: #6e9651; font-size: .68rem; font-weight: 1000; letter-spacing: .12em; }
.admin-shift-edit-heading h3 { margin: .15rem 0; color: var(--farm-green-deep); font-size: 1.25rem; }
.admin-shift-edit-heading p { margin: 0; color: #725f4e; font-size: .82rem; font-weight: 800; }
.modal-close-button { width: 2.35rem; height: 2.35rem; flex: 0 0 auto; border: 0; border-radius: 50%; background: #eee8dd; color: #684f39; font-size: 1.5rem; font-weight: 900; cursor: pointer; }
.admin-shift-edit-notice { margin-bottom: 1rem; padding: .8rem 1rem; border: 2px solid #f1cf79; border-radius: .9rem; background: #fff7d8; color: #7a581c; font-size: .8rem; font-weight: 800; }
.admin-shift-edit-actions { position: sticky; bottom: -.1rem; padding-top: 1rem; background: linear-gradient(transparent, #fffdf6 24%); }

.employee-hero {
  padding: 2rem !important;
  color: white;
  text-align: center;
  border: 0;
  background: linear-gradient(135deg, #3ca45a, #257544 70%, #195d37) !important;
  box-shadow: var(--shadow-lg);
}

.employee-hero::before { width: 100%; height: 9px; background: repeating-linear-gradient(90deg, #ffd85c 0 42px, #ff9f43 42px 84px); }
.employee-hero h2 { position: relative; z-index: 1; font-size: 1.5rem; margin-bottom: .5rem; }
.employee-greeting-name { display: inline-block; white-space: nowrap; }
.employee-hero p { position: relative; z-index: 1; opacity: .94; margin-bottom: 1.25rem; font-weight: 800; }
.hero-crop { position: absolute; right: 1.3rem; bottom: -.8rem; font-size: 6rem; opacity: .2; transform: rotate(-8deg); }
.hero-action { position: relative; z-index: 1; width: 100%; background: #fff; color: var(--farm-green-deep); font-weight: 900; box-shadow: 0 5px 0 #cfe5b1; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(180deg, #dff3f1 0 48%, #d9edb6 48% 58%, #9cce73 58% 66%, #795132 66% 100%);
  position: relative;
  overflow: hidden;
}

.login-page::after {
  content: '';
  position: absolute;
  inset: 66% 0 0;
  background: repeating-linear-gradient(100deg, transparent 0 54px, rgba(255,255,255,.09) 55px 61px, transparent 62px 108px);
}

.login-scenery span { position: absolute; z-index: 0; font-size: clamp(2rem, 5vw, 4.5rem); }
.login-scenery span:nth-child(1) { top: 8%; left: 9%; }
.login-scenery span:nth-child(2) { top: 13%; right: 12%; }
.login-scenery span:nth-child(3) { bottom: 27%; left: 13%; }
.login-scenery span:nth-child(4) { bottom: 8%; left: 22%; }
.login-scenery span:nth-child(5) { bottom: 10%; right: 18%; }

.login-card {
  z-index: 1;
  width: min(100%, 440px);
  padding: 2.1rem;
  border: 4px solid #fff;
  background: rgba(255, 253, 244, .97);
  box-shadow: var(--shadow-lg);
}

.login-card::before { width: 100%; height: 9px; background: repeating-linear-gradient(90deg, var(--farm-green) 0 48px, var(--farm-yellow) 48px 96px, var(--farm-orange) 96px 144px); }
.login-heading { text-align: center; margin-bottom: 1.6rem; }
.login-heading h1 { color: var(--farm-green-deep); font-size: 1.65rem; }
.login-heading > p:last-child { color: #826548; font-weight: 800; font-size: .9rem; }
.login-mark { display: grid; place-items: center; width: 5rem; height: 5rem; margin: 0 auto .8rem; border-radius: 48% 52% 45% 55%; background: linear-gradient(145deg, #8ccd63, var(--farm-green)); border: 4px solid #fff; box-shadow: 0 5px 0 var(--farm-green-deep), 0 12px 24px rgba(38, 111, 62, .22); font-size: 2.5rem; transform: rotate(-4deg); }

.modal-content { border-color: #d4e7b7; background: #fffdf6; }
.settings-save-bar { background: linear-gradient(transparent, #fffdf6 30%); }

@media (max-width: 760px) {
  .header-inner { min-height: 68px; padding: .6rem .75rem; }
  .brand-icon { width: 2.55rem; height: 2.55rem; }
  .brand-copy strong { font-size: 1rem; }
  .brand-copy small { font-size: .64rem; }
  .role-badge { max-width: 46vw; padding: .4rem .65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sync-badge { display: none; }
  .header-logout span { display: none; }
  .header-logout { width: 2.65rem; padding: .35rem; }
  .header-password span { display: none; }
  .header-password { width: 2.65rem; padding: .35rem; }
  .main-content { padding: 1.25rem .75rem 2rem; }
  .page-heading { align-items: stretch; flex-direction: column; border-radius: 1.5rem; padding: 1.15rem; }
  .page-heading::after { right: .75rem; bottom: -.25rem; }
  .month-picker { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 135px; }
  .card { padding: 1.15rem; border-radius: 1.4rem; }
  .login-card { padding: 1.6rem 1.25rem; }
  .employee-report-toolbar { align-items: stretch; flex-direction: column; }
  .employee-report-actions { width: 100%; margin-left: 0; }
  .employee-report-actions .month-picker { flex: 1 1 auto; width: auto; min-width: 0; }
  .employee-report-actions .btn, .employee-pdf-locked { flex: 1 1 auto; }
  .employee-pdf-locked .btn { width: 100%; }
  .mobile-nav { overflow-x: auto; justify-content: flex-start; }
  .mobile-nav .nav-item { min-width: 88px; }
  .employee-nav .nav-item { min-width: 90px; }
  .shift-controls { grid-template-columns: 1fr; }
  .shift-guide { align-items: flex-start; flex-direction: column; }
  .shift-window-notice { align-items: flex-start; flex-direction: column; }
  .shift-window-admin { grid-template-columns: 1fr; }
  .shift-window-admin > small { grid-column: auto; }
  .daily-timeline-heading { align-items: flex-start; flex-direction: column; }
  .shift-employee-row { grid-template-columns: 1fr auto; }
  .shift-request-detail { grid-column: 1 / -1; grid-row: 2; }
  .admin-shift-edit-button { grid-column: 1 / -1; width: 100%; }
  .admin-shift-modal-backdrop { padding: .4rem; }
  .admin-shift-edit-modal { width: 98vw; max-height: 97vh; padding: .9rem; }
}

@media (max-width: 560px) {
  .header-inner { gap: .45rem; }
  .brand-copy { display: none; }
  .header-actions { gap: .35rem; min-width: 0; }
  .role-badge { max-width: calc(100vw - 9.5rem); min-width: 0; }
}

/* v8.9: smartphone responsive layout */
@media (max-width: 760px) {
  html,
  body { width: 100%; max-width: 100%; overflow-x: hidden; }

  body { font-size: 15px; }

  .app-container {
    min-width: 0;
    padding-bottom: calc(7.25rem + env(safe-area-inset-bottom));
  }

  .header-inner {
    width: 100%;
    min-width: 0;
    gap: .35rem;
    padding: .55rem .55rem;
  }

  .brand-logo { min-width: 0; gap: .45rem; flex: 0 1 auto; }
  .brand-icon { width: 2.25rem; height: 2.25rem; flex: 0 0 2.25rem; font-size: 1.05rem; }
  .brand-copy { min-width: 0; }
  .brand-copy strong { font-size: .9rem; letter-spacing: .02em; white-space: nowrap; }
  .brand-copy small { display: none; }

  .header-actions { min-width: 0; gap: .3rem; flex: 1 1 auto; justify-content: flex-end; }
  .role-badge {
    min-width: 0;
    max-width: calc(100vw - 8.1rem);
    min-height: 2.35rem;
    padding: .3rem .5rem;
    font-size: .72rem;
  }
  .role-badge svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
  .header-logout { width: 2.35rem; min-width: 2.35rem; min-height: 2.35rem; border-radius: .8rem; }
  .header-logout svg { width: 1.15rem; height: 1.15rem; }

  .main-content { width: 100%; min-width: 0; padding: 1.15rem .55rem 2rem; }
  .card { width: 100%; min-width: 0; padding: 1rem .85rem 1.1rem 1rem; border-radius: 1.25rem; }
  .employee-hero h2 { font-size: clamp(1.3rem, 6.4vw, 1.5rem); line-height: 1.55; }
  .card-title { align-items: flex-start; font-size: 1.05rem; line-height: 1.4; }
  .page-heading { margin-top: .25rem; padding: 1rem; }

  .form-group { min-width: 0; margin-bottom: 1.1rem; }
  .form-label { font-size: .95rem; line-height: 1.55; }
  .form-control { min-width: 0; max-width: 100%; min-height: 3rem; padding: .65rem .75rem; font-size: 16px; }
  input[type="date"].form-control,
  input[type="time"].form-control,
  input[type="month"].form-control { width: 100%; min-width: 0; }

  .tab-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 1rem; }
  .tab-btn { min-width: 0; padding: .65rem .35rem; border-radius: .8rem; font-size: .78rem; line-height: 1.35; overflow-wrap: anywhere; }
  .time-entry-panel { min-width: 0; padding: .8rem; }
  .time-field-grid { grid-template-columns: 1fr; gap: .7rem; }
  .direct-time-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; }
  .direct-time-fields .form-control { width: 100% !important; }
  .harvest-entry-row { grid-template-columns: minmax(0, 2fr) minmax(5.5rem, 1fr); }
  .attendance-form-actions { flex-direction: column; }
  .attendance-form-actions .btn { width: 100%; flex: none !important; }

  .employee-report-actions { display: grid; grid-template-columns: 1fr; }
  .employee-report-actions .month-picker,
  .employee-report-actions .btn,
  .employee-pdf-locked { width: 100%; }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: calc(100% - .6rem);
    max-width: 760px;
    bottom: calc(.3rem + env(safe-area-inset-bottom));
    padding: .35rem;
    overflow: visible;
    border-radius: 1.2rem;
  }
  .employee-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-nav .nav-item,
  .employee-nav .nav-item { width: 100%; min-width: 0; min-height: 3.4rem; padding: .25rem .12rem; }
  .employee-nav .nav-item { grid-template-rows: 1.35rem minmax(1.2rem, auto); gap: .12rem; }
  .employee-nav .nav-icon { width: 1.35rem; height: 1.35rem; font-size: 1.08rem; }
  .employee-nav .nav-icon svg { width: 1.2rem; height: 1.2rem; }
  .employee-nav .nav-label,
  .mobile-nav .nav-item > span { height: auto; max-width: 100%; font-size: .62rem; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
  .mobile-nav .nav-item > svg { width: 1.2rem; height: 1.2rem; }

  .shift-calendar { width: 100%; overflow: visible; }
  .shift-weekdays { display: none; }
  .shift-days {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
  }
  .shift-day.blank,
  .shift-day.outside-period { display: none; }
  .shift-day { min-width: 0; min-height: 82px; padding: .55rem; border-radius: .8rem; }
  .shift-day.admin-day { min-height: 88px; }
  .shift-date-selector { min-height: 2rem; }
  .shift-time-fields label { grid-template-columns: 2rem minmax(0, 1fr); font-size: .62rem; }
  .shift-time-input { min-width: 0; width: 100%; padding: .28rem .2rem; font-size: 16px; }
  .shift-name-chip b { font-size: .66rem; }
  .shift-name-chip small { font-size: .58rem; }
  .shift-window-buttons { width: 100%; }
  .shift-window-button { min-width: 0; }

  .timeline-scroll { max-width: 100%; }
  .timeline-chart { grid-template-columns: 105px minmax(500px, 1fr); min-width: 605px; }
  .timeline-person strong { max-width: 94px; }

  .modal-backdrop { padding: .35rem; }
  .modal-content { width: calc(100vw - .7rem); max-height: calc(100vh - .7rem); padding: 1rem; border-radius: 1.25rem; }
  .modal-actions { grid-template-columns: 1fr; }
}

/* v8.12: iPhone overflow fixes and full-month mobile shift calendar */
@media (max-width: 760px) {
  .main-content,
  .main-content > div,
  .main-content .card,
  .main-content form,
  .main-content section,
  .main-content .form-group,
  .main-content .time-entry-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .main-content input,
  .main-content select,
  .main-content textarea,
  .main-content button {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  .time-entry-panel,
  .time-field-grid,
  .time-field-grid > div { overflow: hidden; }

  input[type="date"].form-control,
  input[type="time"].form-control,
  input[type="month"].form-control,
  .time-field-grid input[type="time"] {
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    margin-inline: 0;
  }

  .btn { white-space: normal; text-align: center; line-height: 1.3; }
  .lock-banner { align-items: flex-start; flex-wrap: wrap; }
  .settings-save-bar .btn { width: 100%; }
  .ranking-item { width: 100%; min-width: 0; }

  .shift-card { padding-inline: .65rem; }
  .shift-calendar { width: 100%; max-width: 100%; overflow: hidden; }
  .shift-weekdays,
  .shift-days {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .16rem;
  }
  .shift-weekdays { margin-bottom: .2rem; }
  .shift-weekdays > div { min-width: 0; padding: .2rem 0; font-size: .62rem; }
  .shift-day.blank,
  .shift-day.outside-period { display: block; }
  .shift-day {
    width: 100%;
    min-width: 0;
    min-height: 3.65rem;
    padding: .24rem .18rem;
    border-width: 1px;
    border-radius: .55rem;
    overflow: hidden;
  }
  .shift-day.admin-day { min-height: 3.65rem; padding: .24rem .18rem; }
  .shift-date-selector { min-height: auto; flex-direction: column; justify-content: flex-start; gap: .08rem; }
  .shift-day-number { font-size: .76rem; line-height: 1; }
  .shift-day-state { align-self: center; max-width: 100%; padding: .08rem .18rem; font-size: .48rem; line-height: 1.2; }
  .shift-time-fields,
  .shift-time-fields.visible { display: none; }
  .shift-mobile-time-button {
    width: 100%;
    min-height: 1.25rem;
    margin-top: .12rem;
    padding: .1rem;
    border: 0;
    border-radius: .3rem;
    background: rgba(255,255,255,.9);
    color: #17643a;
    font-size: 0;
    font-weight: 900;
    cursor: pointer;
  }
  .shift-day.selected .shift-mobile-time-button { display: block; }
  .shift-mobile-time-button::after { content: '時刻'; font-size: .48rem; }
  .shift-name-list { align-items: center; justify-content: center; min-height: 1.2rem; margin-top: .15rem; }
  .shift-name-list > * { display: none; }
  .shift-name-list::after { content: attr(data-count) '名'; color: #567048; font-size: .53rem; font-weight: 900; white-space: nowrap; }
  .shift-day.admin-day.timeline-selected { box-shadow: inset 0 0 0 2px #277b45 !important; }
  .shift-day.own-shift-day { border-width: 2px; }
  .own-shift-legend { margin-top: -.2rem; font-size: .72rem; }

  .mobile-shift-time-backdrop { z-index: 80; padding: .75rem; }
  .mobile-shift-time-modal { width: 100%; max-width: 25rem; padding: 1.1rem; overflow: hidden; }
  .mobile-shift-time-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
  .mobile-shift-time-heading span { color: #68944f; font-size: .7rem; font-weight: 900; letter-spacing: .08em; }
  .mobile-shift-time-heading h3 { color: var(--farm-green-deep); font-size: 1.2rem; }
  .mobile-shift-time-modal .form-control { width: 100%; min-width: 0; max-width: 100%; }
  .mobile-shift-end-label { margin-top: 1rem; }
  .mobile-shift-time-save { width: 100%; margin-top: 1.25rem; }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .main-content { padding-inline: 1rem; }
  .shift-weekdays,
  .shift-days { grid-template-columns: repeat(7, minmax(105px, 1fr)); min-width: 780px; }
}

/* v8.13: keep native iOS controls and every form frame inside its container */
@media (max-width: 760px) {
  .main-content,
  .main-content > div,
  .main-content .card,
  .main-content form,
  .main-content .form-group,
  .main-content .time-entry-panel,
  .main-content .time-field-grid,
  .main-content .time-field-grid > div,
  .modal-content,
  .modal-content > * {
    box-sizing: border-box;
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  .time-entry-panel { overflow: hidden; }
  .time-field-grid,
  .time-field-grid > div { overflow: visible; }

  .form-control,
  input.form-control,
  select.form-control,
  textarea.form-control {
    box-sizing: border-box !important;
    inline-size: 100% !important;
    width: 100% !important;
    min-inline-size: 0 !important;
    min-width: 0 !important;
    max-inline-size: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  .native-time-control {
    box-sizing: border-box;
    inline-size: 100%;
    width: 100%;
    min-inline-size: 0;
    min-width: 0;
    max-inline-size: 100%;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
  }

  .native-time-control > input[type="time"].form-control {
    inline-size: 100% !important;
    width: 100% !important;
    max-inline-size: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  input[type="date"].form-control,
  input[type="time"].form-control,
  input[type="month"].form-control {
    -webkit-appearance: none;
    appearance: none;
    inline-size: calc(100% - 2px) !important;
    width: calc(100% - 2px) !important;
    max-inline-size: calc(100% - 2px) !important;
    max-width: calc(100% - 2px) !important;
    margin-inline: 1px !important;
    border-radius: 1rem !important;
    background-clip: padding-box;
  }

  input[type="date"].form-control::-webkit-date-and-time-value,
  input[type="time"].form-control::-webkit-date-and-time-value,
  input[type="month"].form-control::-webkit-date-and-time-value {
    min-inline-size: 0;
    padding: 0;
    text-align: center;
  }

  .harvest-entry-row,
  .direct-time-fields,
  .employee-report-actions,
  .shift-controls,
  .shift-window-admin,
  .shift-employee-row {
    inline-size: 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .harvest-entry-row > *,
  .direct-time-fields > *,
  .employee-report-actions > *,
  .shift-controls > *,
  .shift-window-admin > *,
  .shift-employee-row > * { min-width: 0; max-width: 100%; }

  .mobile-shift-time-backdrop { padding-inline: .65rem; }
  .mobile-shift-time-modal {
    inline-size: calc(100vw - 1.3rem);
    width: calc(100vw - 1.3rem);
    max-inline-size: 25rem;
    max-width: 25rem;
    margin-inline: auto;
  }

  .mobile-shift-time-modal input[type="time"].form-control {
    inline-size: calc(100% - 2px) !important;
    width: calc(100% - 2px) !important;
  }

  .shift-calendar,
  .shift-weekdays,
  .shift-days { inline-size: 100%; max-inline-size: 100%; }
  .shift-day { min-inline-size: 0; max-inline-size: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
