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

:root {
  --primary:       #2d6a4f;
  --primary-light: #40916c;
  --primary-dark:  #1b4332;
  --secondary:     #74c69d;
  --accent:        #d8f3dc;
  --bg:            #f2f6f3;
  --surface:       #ffffff;
  --text:          #1c2b20;
  --text-muted:    #6b7c70;
  --border:        #d0ddd5;
  --danger:        #e53935;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow:    0 4px 14px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.14);
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --header-h: 62px;
}

body {
  font-family: 'Hiragino Sans','Hiragino Kaku Gothic ProN','Yu Gothic',sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ===== HEADER ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary-dark);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px; z-index: 200;
}
.header-logo {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-size: 1.15rem; font-weight: 800;
  white-space: nowrap;
}
.logo-icon { font-size: 1.5rem; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  color: rgba(255,255,255,.75); padding: 6px 14px;
  border-radius: var(--r-sm); font-size: .9rem;
  transition: all .2s;
}
.nav-link:hover, .nav-link.active {
  color: #fff; background: rgba(255,255,255,.18);
}
.header-right {
  display: flex; align-items: center; gap: 12px; margin-left: auto;
}
.header-user { color: rgba(255,255,255,.7); font-size: .85rem; }
.btn-logout {
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: 5px 13px; border-radius: var(--r-sm);
  font-size: .83rem; cursor: pointer; transition: all .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.26); }

/* ===== LAYOUT ===== */
.main { padding-top: var(--header-h); min-height: 100vh; }
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline   { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--accent); }
.btn-care      { background: #e3f2fd; color: #1565c0; border: 1.5px solid #90caf9; }
.btn-care:hover { background: #bbdefb; }
.btn-growth    { background: #f3e5f5; color: #6a1b9a; border: 1.5px solid #ce93d8; }
.btn-growth:hover { background: #e1bee7; }
.btn-danger    { background: #ffebee; color: #c62828; border: 1.5px solid #ef9a9a; }
.btn-danger:hover { background: #ffcdd2; }
.btn-success   { background: var(--accent); color: var(--primary-dark); border: 1.5px solid var(--secondary); }
.btn-success:hover { background: var(--secondary); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0 16px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 1.45rem; font-weight: 800; color: var(--primary-dark); }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px; flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-box input {
  width: 100%; padding: 9px 12px 9px 38px;
  border: 1.5px solid var(--border); border-radius: 24px;
  font-size: .9rem; background: #fff; outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--primary); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .95rem; }
.sort-select {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-size: .88rem;
  background: #fff; cursor: pointer; outline: none;
  font-family: inherit;
}
.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.view-btn {
  padding: 7px 13px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); font-size: 1.1rem;
  transition: all .2s;
}
.view-btn.active { background: var(--primary); color: #fff; }
.plant-count { font-size: .85rem; color: var(--text-muted); margin-left: auto; }

/* ===== CARD GRID ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px; padding-bottom: 80px;
}
.plant-card {
  background: #fff; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.plant-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.card-img-wrap {
  position: relative; width: 100%; padding-top: 72%;
  overflow: hidden;
}
.card-img-wrap .img-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
}
.card-img-wrap img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .3s;
}
.plant-card:hover .card-img-wrap img { transform: scale(1.04); }
.card-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(27,67,50,.82); color: #fff;
  font-size: .7rem; padding: 3px 9px; border-radius: 20px;
  backdrop-filter: blur(4px);
}
.card-type-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.88); color: var(--primary-dark);
  font-size: .68rem; padding: 2px 8px; border-radius: 20px;
}

.card-body { padding: 13px 14px 10px; }
.card-name { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-scientific { font-size: .72rem; color: var(--text-muted); font-style: italic; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-memo { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 10px; }

.card-care-days {
  font-size: .68rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-footer {
  display: flex; gap: 6px;
  border-top: 1px solid var(--border); padding-top: 9px;
}
.card-footer .btn { flex: 1; justify-content: center; font-size: .76rem; padding: 6px 4px; }

/* ===== LIST VIEW ===== */
.list-view {
  background: #fff; border-radius: var(--r);
  box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 80px;
}
.list-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.list-table thead { background: var(--primary-dark); color: #fff; }
.list-table th { padding: 11px 14px; text-align: left; font-weight: 600; font-size: .8rem; white-space: nowrap; }
.list-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tbody tr:hover td { background: var(--bg); }
.list-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.list-thumb-ph { width: 46px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .73rem; background: var(--accent); color: var(--primary-dark); font-weight: 600; }
.tag-blue   { background: #e3f2fd; color: #1565c0; }
.tag-green  { background: #e8f5e9; color: #2e7d32; }
.tag-orange { background: #fff3e0; color: #e65100; }
.list-actions { display: flex; gap: 6px; }

/* ===== FAB ===== */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; font-size: 1.8rem; cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; z-index: 100;
}
.fab:hover { background: var(--primary-light); transform: scale(1.06); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 500;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-lg);
  width: 100%; max-width: 500px; max-height: 92vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 1.05rem; font-weight: 800; color: var(--primary-dark); }
.modal-plant-name { font-size: .85rem; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .85rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.form-label .req { color: var(--danger); margin-left: 3px; }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: .9rem; outline: none; transition: border-color .2s;
  font-family: inherit; background: #fff;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.care-type-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.care-type-btn {
  padding: 10px 6px; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); background: #fff;
  cursor: pointer; font-size: .82rem; text-align: center;
  transition: all .2s; font-family: inherit;
}
.care-type-btn .care-emoji { display: block; font-size: 1.4rem; margin-bottom: 3px; }
.care-type-btn:hover { border-color: var(--primary-light); background: var(--accent); }
.care-type-btn.selected { background: var(--accent); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }

.img-upload-area {
  border: 2px dashed var(--border); border-radius: var(--r);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: var(--bg);
}
.img-upload-area:hover { border-color: var(--primary); background: var(--accent); }
.img-upload-icon { font-size: 2.2rem; margin-bottom: 8px; }
.img-upload-text { font-size: .88rem; color: var(--text-muted); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #1b4332 0%, #2d6a4f 45%, #40916c 100%);
  padding: 20px;
}
.login-card { background: #fff; border-radius: var(--r-lg); padding: 44px 40px; width: 100%; max-width: 390px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo-icon { font-size: 3.2rem; display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 1.6rem; color: var(--primary-dark); font-weight: 800; }
.login-logo p { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.login-btn   { width: 100%; padding: 12px; font-size: 1rem; border-radius: var(--r-sm); margin-top: 6px; }
.login-error { background: #fff3f3; border: 1.5px solid #ef9a9a; border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 18px; font-size: .88rem; color: #c62828; }
.form-control.is-error { border-color: var(--danger); background: #fff8f8; }

/* ===== DETAIL PAGE ===== */
.breadcrumb { display: flex; align-items: center; gap: 8px; padding: 16px 0 0; font-size: .85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); }
.breadcrumb-sep { color: var(--border); }

.detail-hero { background: #fff; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.detail-hero-inner { display: grid; grid-template-columns: 300px 1fr; }
.detail-images { display: flex; flex-direction: column; }
.detail-main-img { width: 100%; height: 260px; object-fit: cover; }
.detail-main-ph { width: 100%; height: 260px; display: flex; align-items: center; justify-content: center; font-size: 6rem; }
.detail-sub-ph { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; border-top: 2px solid #fff; }

.detail-info { padding: 24px 28px; }
.detail-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-name { font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 3px; }
.detail-scientific { font-size: .9rem; color: var(--text-muted); font-style: italic; margin-bottom: 10px; }
.detail-memo { font-size: .9rem; color: var(--text-muted); background: var(--bg); padding: 9px 13px; border-radius: var(--r-sm); margin-bottom: 16px; border-left: 3px solid var(--secondary); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tabs-wrap { background: #fff; border-radius: var(--r); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.tabs { display: flex; background: var(--bg); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-btn { padding: 13px 18px; border: none; background: none; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; transition: all .2s; border-bottom: 3px solid transparent; font-family: inherit; }
.tab-btn:hover { color: var(--primary); background: var(--accent); }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); background: #fff; }
.tab-content { display: none; padding: 20px 24px; }
.tab-content.active { display: block; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.info-item { background: var(--bg); border-radius: var(--r-sm); padding: 11px 14px; }
.info-label { font-size: .74rem; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }
.info-value { font-size: .92rem; font-weight: 700; color: var(--text); }

.season-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.season-card { border-radius: var(--r-sm); overflow: hidden; }
.season-header { padding: 8px 14px; font-weight: 700; font-size: .88rem; color: #fff; }
.season-header.summer { background: #f57c00; }
.season-header.winter { background: #1565c0; }
.season-body { background: var(--bg); padding: 12px 14px; }
.season-row { display: flex; gap: 8px; margin-bottom: 8px; font-size: .88rem; }
.season-row:last-child { margin-bottom: 0; }
.season-key { color: var(--text-muted); font-weight: 600; min-width: 70px; }

/* ===== SECTION CARD ===== */
.section-card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 20px 24px; margin-bottom: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 1rem; font-weight: 800; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }

/* ===== CARE HISTORY ===== */
.care-list { display: flex; flex-direction: column; gap: 8px; }
.care-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 13px; background: var(--bg); border-radius: var(--r-sm); }
.care-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.ci-water      { background: #e3f2fd; }
.ci-repot      { background: #fff3e0; }
.ci-prune      { background: #f3e5f5; }
.ci-fertilizer { background: #e8f5e9; }
.ci-other      { background: #fce4ec; }
.care-meta { flex: 1; min-width: 0; }
.care-date { font-size: .76rem; color: var(--text-muted); }
.care-type-name { font-weight: 700; font-size: .9rem; }
.care-note { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

/* ===== PWA インストールバナー ===== */
.pwa-install-banner {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--primary-dark); color: #fff;
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 12px 14px; gap: 10px;
  align-items: center; z-index: 500;
  width: calc(100% - 32px); max-width: 420px;
}
.pwa-install-icon  { font-size: 1.8rem; flex-shrink: 0; }
.pwa-install-text  { flex: 1; font-size: .82rem; line-height: 1.5; }
.pwa-install-text strong { font-size: .9rem; }
.pwa-install-btn {
  background: var(--secondary); color: var(--primary-dark);
  border: none; border-radius: var(--r-sm);
  padding: 7px 16px; font-size: .85rem; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.pwa-install-btn:hover { background: #fff; }
.pwa-install-close {
  background: none; border: none; color: rgba(255,255,255,.6);
  font-size: 1.1rem; cursor: pointer; padding: 4px; flex-shrink: 0;
}
.pwa-install-close:hover { color: #fff; }

/* ===== BULK CARE MODE ===== */
.bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #e3f2fd;
  border: 1.5px solid #90caf9;
  border-radius: var(--r);
  padding: 10px 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-bar.open { display: flex; }
.bulk-bar-left  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-bar-right { display: flex; align-items: center; gap: 8px; }
.bulk-mode-label { font-weight: 700; font-size: .9rem; color: #1565c0; white-space: nowrap; }
.bulk-count-badge {
  background: #1565c0; color: #fff;
  font-size: .8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
  white-space: nowrap; min-width: 70px; text-align: center;
}
.btn-sm { padding: 5px 12px; font-size: .8rem; }

/* チェックボックス */
.bulk-check {
  width: 18px; height: 18px; cursor: pointer;
  accent-color: var(--primary);
}
/* 選択中の行 */
#listView tbody tr.bulk-selected { background: #e3f2fd !important; }
#listView.bulk-mode tbody tr:hover { cursor: pointer; }

/* 一括モード時：サムネイルを大きく */
#listView.bulk-mode .list-thumb-ph {
  width: 68px !important;
  height: 68px !important;
  font-size: 2rem;
}

/* ===== CARE LIST TABLE ===== */
.care-list-table { width: 100%; }
.care-list-table thead th {
  background: var(--bg);
  padding: 10px 16px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.care-list-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.care-list-table tbody tr:last-child { border-bottom: none; }
.care-list-table tbody tr:hover { background: var(--accent); }
.care-list-table td { padding: 11px 16px; vertical-align: middle; }

/* ===== GROWTH RECORDS ===== */
.growth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 10px; }
.growth-item { border-radius: var(--r-sm); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .2s; }
.growth-item:hover { transform: scale(1.02); }
.growth-img-ph { aspect-ratio: 1; width: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; object-fit: cover; }
.growth-meta { background: var(--bg); padding: 5px 8px; }
.growth-date { font-size: .72rem; color: var(--text-muted); }
.growth-memo-text { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 5px; padding-top: 16px; }
.page-btn { width: 34px; height: 34px; border-radius: var(--r-sm); border: 1.5px solid var(--border); background: #fff; cursor: pointer; font-size: .85rem; display: flex; align-items: center; justify-content: center; transition: all .2s; color: var(--text); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .4; cursor: not-allowed; }

/* ===== ADMIN ===== */
.admin-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; padding: 20px 0 60px; }
.admin-sidebar { background: #fff; border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 12px; height: fit-content; position: sticky; top: calc(var(--header-h) + 20px); }
.admin-group-label { font-size: .7rem; color: var(--text-muted); padding: 10px 12px 4px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.admin-nav-item { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: var(--r-sm); cursor: pointer; font-size: .88rem; color: var(--text); transition: all .2s; }
.admin-nav-item:hover { background: var(--bg); }
.admin-nav-item.active { background: var(--accent); color: var(--primary-dark); font-weight: 700; }
.admin-nav-divider { height: 1px; background: var(--border); margin: 8px 0; }

.master-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.master-title { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }

.master-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.master-table th { text-align: left; padding: 9px 14px; border-bottom: 2px solid var(--border); font-weight: 700; color: var(--text-muted); font-size: .78rem; }
.master-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.master-table tr:last-child td { border-bottom: none; }
.master-table tbody tr:hover td { background: var(--bg); }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: 1.1rem; user-select: none; }
.master-input { border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 5px 10px; font-size: .88rem; font-family: inherit; outline: none; }
.master-input:focus { border-color: var(--primary); }

/* ===== ADD/EDIT FORM ===== */
.mode-bar { display: flex; align-items: center; gap: 16px; padding: 16px 0; flex-wrap: wrap; }
.mode-tabs { display: flex; border: 2px solid var(--primary); border-radius: var(--r-sm); overflow: hidden; }
.mode-tab { padding: 8px 22px; border: none; background: #fff; color: var(--primary); font-size: .9rem; font-weight: 700; cursor: pointer; transition: all .2s; font-family: inherit; }
.mode-tab.active { background: var(--primary); color: #fff; }
.mode-desc { font-size: .82rem; color: var(--text-muted); }

.form-section { background: #fff; border-radius: var(--r); box-shadow: var(--shadow-sm); margin-bottom: 18px; overflow: hidden; }
.form-section-head { background: var(--primary-dark); color: #fff; padding: 12px 20px; font-weight: 800; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.form-section-body { padding: 20px; }
.form-col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-col-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.img-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.img-upload-box { border: 2px dashed var(--border); border-radius: var(--r); padding: 20px; text-align: center; cursor: pointer; transition: all .2s; background: var(--bg); }
.img-upload-box:hover { border-color: var(--primary); background: var(--accent); }
.img-upload-emoji { font-size: 2rem; margin-bottom: 6px; }
.img-upload-label { font-size: .85rem; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; }
.img-upload-hint { font-size: .75rem; color: #aaa; }

.char-rating { display: flex; gap: 6px; }
.rating-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; transition: all .2s; }
.rating-dot.filled { background: var(--primary); border-color: var(--primary); }

.form-bottom { display: flex; justify-content: flex-end; gap: 12px; padding: 20px 0 60px; }

/* ===== KILLED LIST ===== */
.killed-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.killed-item:last-child { border-bottom: none; }
.killed-thumb { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.killed-info { flex: 1; min-width: 0; }
.killed-name { font-weight: 700; font-size: .9rem; }
.killed-date { font-size: .75rem; color: var(--text-muted); }

/* ===== NOTICE / EMPTY ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty-text { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: .85rem; }

/* ===== RECORD ACTIONS ===== */
.record-actions { display: flex; gap: 4px; flex-shrink: 0; align-self: flex-start; padding-top: 2px; }

/* ===== LIGHTBOX ===== */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 600; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox-inner { position: relative; cursor: default; animation: modalIn .2s ease; }
.lightbox-close { position: absolute; top: -14px; right: -14px; background: #fff; border: none; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.img-zoomable { cursor: zoom-in; }

/* ===== HAMBURGER ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  margin-right: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,.85);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .detail-hero-inner { grid-template-columns: 1fr; }
  .detail-main-img { height: 220px; }
  .detail-main-ph { height: 220px; }
  .detail-info { padding: 18px 20px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .admin-group-label { display: none; }
  .season-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .header { padding: 0 14px; }

  /* nav: hidden by default, revealed as dropdown via .open */
  .header-nav { display: none; }
  .header-nav.open {
    display: flex; flex-direction: column;
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--primary-dark);
    padding: 8px 14px 14px; gap: 2px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    z-index: 199;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .header-nav.open .nav-link { padding: 13px 14px; font-size: .95rem; }
  .hamburger { display: flex; }

  /* list view: horizontal scroll on narrow screens */
  .list-view { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .list-table { min-width: 600px; }

  /* cards */
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }

  /* forms */
  .form-col-2, .form-col-3 { grid-template-columns: 1fr; }
  .img-pair { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-bottom { flex-direction: column-reverse; }
  .form-bottom .btn { width: 100%; justify-content: center; }

  /* detail actions */
  .detail-actions { gap: 7px; }
  .detail-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

  /* records */
  .info-grid { grid-template-columns: 1fr 1fr; }
  .growth-grid { grid-template-columns: repeat(3,1fr); }

  /* section-card padding */
  .section-card { padding: 16px; }
  .tab-content { padding: 16px; }
}
/* ===== GROWTH GALLERY ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.gallery-item {
  background: var(--surface);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.gallery-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--accent);
}
.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.gallery-item:hover .gallery-img-wrap img {
  transform: scale(1.04);
}
.gallery-info {
  padding: 10px 12px 12px;
}
.gallery-plant {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-date {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox-overlay.open {
  display: flex;
}
.lightbox-inner {
  position: relative;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-img {
  max-width: 100%;
  max-height: calc(90vh - 72px);
  object-fit: contain;
  border-radius: var(--r-sm);
  display: block;
}
.lightbox-caption {
  width: 100%;
  padding: 10px 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lightbox-plant {
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lightbox-date {
  color: rgba(255,255,255,.65);
  font-size: .85rem;
  white-space: nowrap;
}
.lightbox-close {
  position: fixed; top: 18px; right: 22px;
  background: rgba(255,255,255,.15);
  border: none; color: #fff;
  font-size: 1.3rem; line-height: 1;
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s;
  display: flex; align-items: center; justify-content: center;
  z-index: 1001;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none; color: #fff;
  font-size: 2.4rem; line-height: 1;
  width: 48px; height: 64px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .2s;
  display: flex; align-items: center; justify-content: center;
  z-index: 1001;
}
.lightbox-nav:hover { background: rgba(255,255,255,.3); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .lightbox-nav { width: 36px; height: 52px; font-size: 1.8rem; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}

@media (max-width: 400px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .care-type-grid { grid-template-columns: repeat(2,1fr); }
  .detail-actions .btn { min-width: 0; font-size: .78rem; padding: 7px 10px; }
}
