/* 梨屋さん管理画面テーマ（シンプル・洗練・モダン）
   - Django admin の CSS 変数を上書きして、ブランドのグリーンを基調に統一
   - フラットな配色＋余白＋やわらかい影で現代的に
   - ライト/ダークのテーマ切替に追従
*/

/* ===== パレット & Django admin 変数の上書き（ライト） ===== */
:root,
:root[data-theme="light"] {
  --brand: #2e7d32;          /* 基調グリーン */
  --brand-strong: #1b5e20;   /* 濃いグリーン（ホバー等） */
  --brand-tint: #eef6f0;     /* 淡いグリーン（見出し背景） */
  --brand-tint-2: #f6faf7;   /* さらに淡い面 */
  --orch-page: #f5f7f4;
  --orch-surface: #ffffff;
  --orch-text: #1e2b20;
  --orch-muted: #627065;
  --orch-card-border: #d4ddd5;

  /* OS がダーク設定でも、管理画面でライトテーマを選んだ場合はこちらを優先する。 */
  --body-fg: #1e2b20;
  --body-bg: #f5f7f4;
  --body-quiet-color: #627065;
  --body-medium-color: #465548;
  --body-loud-color: #102014;
  --breadcrumbs-link-fg: #1b5e20;
  --breadcrumbs-bg: #ffffff;
  --hairline-color: #e6e9ec;
  --border-color: #d8dfd9;
  --darkened-bg: #edf2ee;
  --close-button-bg: #647466;
  --close-button-hover-bg: #465548;
  color-scheme: light;

  /* Django admin のアクセント系を一括でグリーン化 */
  --primary: var(--brand);
  --secondary: var(--brand);
  --accent: var(--brand-strong);
  --primary-fg: #ffffff;

  --link-fg: #1f6b34;
  --link-hover-color: var(--brand-strong);
  --link-selected-fg: var(--brand-strong);

  --button-bg: var(--brand);
  --button-hover-bg: var(--brand-strong);
  --default-button-bg: var(--brand);
  --default-button-hover-bg: var(--brand-strong);
  --object-tools-bg: var(--brand-strong);
  --object-tools-hover-bg: #163f17;

  --selected-row: #fff8e1;   /* 行選択は控えめなアンバー */
  --selected-bg: var(--brand-tint);

  /* 自前のヘッダ/見出し用 */
  --orch-bar-bg: var(--brand);
  --orch-h2-bg: var(--brand-tint);
  --orch-h2-fg: #103d18;
  --orch-border: #e6e9ec;
  --orch-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

/* ===== ダークテーマ ===== */
:root[data-theme="dark"] {
  --brand: #4caf50;
  --brand-strong: #66bb6a;
  --brand-tint: #14301a;
  --brand-tint-2: #11261a;

  --primary: var(--brand);
  --secondary: var(--brand);
  --accent: var(--brand-strong);
  --primary-fg: #0b1f0e;

  --link-fg: #7fd089;
  --link-hover-color: #a5e0ad;
  --link-selected-fg: #a5e0ad;

  --button-bg: var(--brand);
  --button-hover-bg: var(--brand-strong);
  --default-button-bg: var(--brand);
  --default-button-hover-bg: var(--brand-strong);
  --object-tools-bg: #2e7d32;
  --object-tools-hover-bg: #1b5e20;

  --selected-row: #2a2a14;
  --selected-bg: var(--brand-tint);

  --orch-bar-bg: #1b5e20;
  --orch-h2-bg: var(--brand-tint);
  --orch-h2-fg: #e8f5e9;
  --orch-border: #2b2f33;
  --orch-card-border: #435047;
  --orch-card-shadow: none;
  --orch-page: #152018;
  --orch-surface: #1e2a20;
  --orch-text: #edf5ee;
  --orch-muted: #b6c5b8;
  --body-fg: #edf5ee;
  --body-bg: #152018;
  --body-quiet-color: #b6c5b8;
  --body-medium-color: #d2ded3;
  --body-loud-color: #ffffff;
  --breadcrumbs-link-fg: #a4e1a7;
  --breadcrumbs-bg: #1e2a20;
  --hairline-color: #3b4a3d;
  --border-color: #3b4a3d;
  --darkened-bg: #1a251c;
  --close-button-bg: #4b5e4e;
  --close-button-hover-bg: #6a806e;
  color-scheme: dark;
}

/* テーマが「自動」のときも、OSのダーク設定に合わせて独自UIを切り替える。 */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand: #73c878;
    --brand-strong: #a4e1a7;
    --brand-tint: #18371d;
    --brand-tint-2: #11261a;
    --link-fg: #9fe4a3;
    --link-hover-color: #c4f0c6;
    --link-selected-fg: #c4f0c6;
    --orch-bar-bg: #1b5e20;
    --orch-h2-bg: #18371d;
    --orch-h2-fg: #edf5ee;
    --orch-border: #3b4a3d;
    --orch-card-border: #526456;
    --orch-card-shadow: none;
    --orch-page: #152018;
    --orch-surface: #1e2a20;
    --orch-text: #edf5ee;
    --orch-muted: #b6c5b8;
    --body-fg: #edf5ee;
    --body-bg: #152018;
    --body-quiet-color: #b6c5b8;
    --body-medium-color: #d2ded3;
    --body-loud-color: #ffffff;
    --breadcrumbs-link-fg: #a4e1a7;
    --breadcrumbs-bg: #1e2a20;
    --hairline-color: #3b4a3d;
    --border-color: #3b4a3d;
    --darkened-bg: #1a251c;
    --close-button-bg: #4b5e4e;
    --close-button-hover-bg: #6a806e;
    color-scheme: dark;
  }
}

/* ===== ヘッダーバー（フラット＋やわらかい影） ===== */
#header,
.sticky #header {
  background: var(--orch-bar-bg) !important;
  color: #fff !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 2px 8px rgba(16, 24, 40, 0.08);
  border-bottom: none !important;
}

/* ヘッダー直下の現在地表示は、ヘッダーから独立した読みやすい帯にする。 */
nav[aria-label="パンくずリスト"] {
  background: var(--orch-surface);
  border-bottom: 1px solid var(--orch-border);
}

.breadcrumbs {
  box-sizing: border-box;
  max-width: 1600px;
  margin: 0 auto;
  padding: 13px 36px;
  background: transparent !important;
  color: var(--orch-muted) !important;
  font-size: 14px;
  line-height: 1.45;
}

.breadcrumbs a,
.breadcrumbs a:link,
.breadcrumbs a:visited {
  color: var(--brand-strong) !important;
  font-weight: 700;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
  color: var(--link-hover-color) !important;
}
#header a,
#header a:link,
#header a:visited,
#header .branding h1,
#header .branding h1 a {
  color: #fff !important;
}

#user-tools,
#user-tools a,
#user-tools a:link,
#user-tools a:visited {
  color: #fff !important;
}

/* 公開サイトの確認は、日常的に使う主要な行動として見つけやすくする。 */
#user-tools > a:first-of-type {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  box-sizing: border-box;
  margin: 0 3px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 7px;
  background: rgba(255, 255, 255, .16);
  font-weight: 700;
  text-decoration: none;
}

#user-tools > a:first-of-type:hover,
#user-tools > a:first-of-type:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, .28);
  outline: 2px solid rgba(255, 255, 255, .85);
  outline-offset: 2px;
}

#logout-form button {
  min-height: auto;
  margin-left: 5px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #fff !important;
  font-size: 12px;
  font-weight: 500;
  opacity: .8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#logout-form button:hover,
#logout-form button:focus-visible {
  border-color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .12);
  opacity: 1;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#site-name {
  font-weight: 650;
  letter-spacing: 0.01em;
}

#site-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 760;
  text-decoration: none;
}

.site-mark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  font-size: 16px;
}

.welcome-label {
  margin-right: 6px;
  opacity: .75;
  font-size: 12px;
}

/* ===== 画面全体と目的別ナビゲーション ===== */
body {
  background: var(--orch-page);
  color: var(--orch-text);
}

/* ログイン画面は入力しやすい幅を確保し、極端に細い既定レイアウトを避ける。 */
body.login #container {
  width: 560px !important;
  max-width: calc(100% - 32px);
}

body.login #content {
  box-sizing: border-box;
  width: 560px !important;
  max-width: calc(100% - 32px);
  margin: 56px auto;
  padding: 0;
}

body.login #content-main {
  width: 100% !important;
}

body.login #login-form {
  padding: 28px 32px;
}

body.login #login-form input[type="text"],
body.login #login-form input[type="password"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
}

#main {
  background: var(--orch-page);
}

.admin-navigation {
  box-sizing: border-box;
  padding: 18px 12px 24px;
  background: var(--orch-surface);
  /* Django の標準ナビ用の hidden 指定を、独自メニューでは使わない。 */
  visibility: visible !important;
}

body #nav-sidebar.admin-navigation {
  background: var(--orch-surface) !important;
  color: var(--orch-text) !important;
}

.admin-navigation * {
  visibility: visible;
}

.nav-section {
  margin: 0 0 20px;
}

.nav-section h2 {
  margin: 0 10px 8px;
  color: var(--orch-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-section a {
  display: block;
  margin: 2px 0;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--orch-text);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.nav-section a:hover,
.nav-section a:focus-visible,
.nav-section a[aria-current="page"] {
  background: var(--brand-tint);
  color: var(--brand-strong);
  outline: none;
}

.nav-home {
  background: var(--brand);
  color: #fff !important;
  font-weight: 700;
}

.nav-home:hover,
.nav-home:focus-visible {
  background: var(--brand-strong) !important;
  color: #fff !important;
}

.nav-section-admin {
  padding-top: 14px;
  border-top: 1px solid var(--orch-border);
}

.nav-menu-disclosure > summary {
  display: none;
}

/* Django 標準の折りたたみ式サイドバーを、通常の固定メニューとして使う。 */
@media (min-width: 768px) {
  /* グリッドで左右の領域を明確に確保し、サイドバーが一覧に重なるのを防ぐ。 */
  body:not(.login) #main {
    display: grid !important;
    grid-template-columns: 275px minmax(0, 1fr);
    min-width: 0;
  }
  body #nav-sidebar.admin-navigation {
    grid-column: 1;
    grid-row: 1;
    position: sticky !important;
    top: 0;
    left: auto !important;
    margin-left: 0 !important;
    z-index: auto;
    display: block !important;
    width: 275px !important;
    min-width: 275px;
    height: calc(100vh - 98px);
    flex: 0 0 275px;
    transform: none !important;
    overflow-y: auto;
  }
  /* 通知（messagelist）と本文は縦に積む。横並びにすると通知が一覧の隣に
     割り込み、表示列が押しつぶされてしまう。 */
  body #content-start {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  /* Django 標準の「開閉式サイドバー」用の最大幅指定を解除する。 */
  body:not(.login) #main > #nav-sidebar + #content-start,
  body:not(.login) #main.shifted > #nav-sidebar + #content-start {
    max-width: none !important;
  }
  body .dashboard #content {
    width: min(100%, 1280px);
    max-width: 1280px;
  }
}

/* ===== ダッシュボード ===== */
.dashboard #content {
  box-sizing: border-box;
  width: 100%;
  max-width: 1280px;
  padding: 32px 36px 48px;
}

.dashboard-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 28px;
}

.dashboard-hero-simple {
  align-items: center;
  margin-bottom: 20px;
  padding: 4px 0 22px;
  border-bottom: 1px solid var(--orch-border);
}

.dashboard-hero h1,
.section-heading h2,
.dashboard-guide h2 {
  margin: 0;
  color: var(--orch-text);
  font-weight: 720;
}

.dashboard-hero h1 {
  font-size: clamp(27px, 3vw, 36px);
}

.dashboard-hero p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--orch-muted);
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
}

.dashboard-site-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  box-sizing: border-box;
  padding: 8px 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.dashboard-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid #d99a93;
  border-radius: 12px;
  background: #fff4f2;
  color: #76221d;
}

.dashboard-alert a { color: inherit; font-weight: 700; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 34px;
}

.status-card,
.quick-action,
.dashboard-guide {
  box-sizing: border-box;
  border: 2px solid var(--orch-card-border);
  border-radius: 14px;
  background: var(--orch-surface);
  background-clip: padding-box;
  box-shadow: var(--orch-card-shadow);
}

.status-card {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  padding: 20px;
}

.status-card > p,
.status-card > span {
  margin: 0;
  color: var(--orch-muted);
  font-size: 13px;
}

.status-card h2 {
  margin: 10px 0 5px;
  color: var(--orch-text);
  font-size: 20px;
  line-height: 1.35;
}

.status-card a {
  margin-top: auto;
  padding-top: 18px;
  color: var(--brand-strong);
  font-size: 14px;
  font-weight: 700;
}

.status-success { border-top: 4px solid #2e7d32; }
.status-warning { border-top: 4px solid #d08700; }
.status-danger { border-top: 4px solid #b3261e; }
.status-neutral { border-top: 4px solid #6b746c; }

.section-heading { margin-bottom: 14px; }
.section-heading h2 { font-size: 24px; }

.quick-actions .eyebrow {
  margin-bottom: 9px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .04em;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.quick-action {
  min-height: 154px;
  padding: 20px;
  color: var(--orch-text);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.quick-action:hover,
.quick-action:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgba(22, 64, 31, .13);
  color: var(--orch-text);
  outline: 3px solid rgba(46, 125, 50, .18);
  outline-offset: 2px;
  transform: translateY(-2px);
}

.quick-action > span {
  display: inline-grid;
  min-width: 42px;
  min-height: 32px;
  place-items: center;
  margin-bottom: 15px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 750;
}

.quick-action strong,
.quick-action small { display: block; }
.quick-action strong { font-size: 16px; }
.quick-action small { margin-top: 8px; color: var(--orch-muted); font-size: 13px; line-height: 1.5; }

.dashboard-guide {
  margin-top: 28px;
  padding: 20px 24px;
}

.dashboard-guide h2 { font-size: 18px; }
.dashboard-guide ul { margin: 12px 0 0; padding-left: 1.4em; color: var(--orch-muted); }
.dashboard-guide li + li { margin-top: 6px; }

/* ===== 通知メッセージ（追加・変更・削除の結果） ===== */
/* #content-start 直下に置かれるため、本文と同じ幅で見出しの上に帯として表示する。 */
.messagelist {
  box-sizing: border-box;
  width: 100%;
  max-width: 1280px;
  margin: 0;
  padding: 20px 40px 0;
  list-style: none;
}

.messagelist:empty {
  display: none;
}

ul.messagelist li {
  --orch-msg-bg: var(--brand-tint);
  --orch-msg-border: #bfdcc4;
  --orch-msg-accent: var(--brand);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 12px 16px;
  border: 1px solid var(--orch-msg-border);
  border-left: 4px solid var(--orch-msg-accent);
  border-radius: 10px;
  background: var(--orch-msg-bg);
  background-image: none;
  box-shadow: var(--orch-card-shadow);
  color: var(--orch-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

ul.messagelist li::before {
  content: '\2713';
  flex: 0 0 auto;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--orch-msg-accent);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

ul.messagelist li.warning::before { content: '\FF01'; }
ul.messagelist li.error::before { content: '\FF01'; }

ul.messagelist li.success {
  --orch-msg-bg: var(--brand-tint);
  --orch-msg-border: #bfdcc4;
  --orch-msg-accent: var(--brand);
}

ul.messagelist li.warning {
  --orch-msg-bg: #fff8e6;
  --orch-msg-border: #f0dcae;
  --orch-msg-accent: #b26b00;
}

ul.messagelist li.error {
  --orch-msg-bg: #fdeceb;
  --orch-msg-border: #f2c4c0;
  --orch-msg-accent: #c0392b;
}

:root[data-theme="dark"] ul.messagelist li.success {
  --orch-msg-bg: #16301c;
  --orch-msg-border: #2c5133;
  --orch-msg-accent: #57a75f;
}

:root[data-theme="dark"] ul.messagelist li.warning {
  --orch-msg-bg: #332a12;
  --orch-msg-border: #5a4a1f;
  --orch-msg-accent: #d9a13a;
}

:root[data-theme="dark"] ul.messagelist li.error {
  --orch-msg-bg: #3a1e1c;
  --orch-msg-border: #62322e;
  --orch-msg-accent: #e07b6f;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] ul.messagelist li.success {
    --orch-msg-bg: #16301c;
    --orch-msg-border: #2c5133;
    --orch-msg-accent: #57a75f;
  }

  :root[data-theme="auto"] ul.messagelist li.warning {
    --orch-msg-bg: #332a12;
    --orch-msg-border: #5a4a1f;
    --orch-msg-accent: #d9a13a;
  }

  :root[data-theme="auto"] ul.messagelist li.error {
    --orch-msg-bg: #3a1e1c;
    --orch-msg-border: #62322e;
    --orch-msg-accent: #e07b6f;
  }
}

@media (max-width: 767px) {
  .messagelist {
    max-width: none;
    padding: 16px 16px 0;
  }
}

/* ===== 一覧・フォームの読みやすさ ===== */
#content {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  color: var(--orch-text);
  font-size: 15px;
  line-height: 1.55;
}

#content-main,
#changelist-form {
  min-width: 0;
  max-width: 100%;
}

/* 幅の広い一覧表はコンテンツ領域内だけを横スクロールさせ、ページ全体を崩さない。 */
#changelist {
  max-width: 100%;
  overflow-x: auto;
}

#content h1 {
  color: var(--orch-text);
  font-size: 28px;
  font-weight: 720;
}

#changelist .actions,
#changelist .paginator,
.submit-row {
  border-radius: 10px;
}

#changelist-filter {
  border-radius: 12px;
}

#changelist-filter h2 {
  border-radius: 12px 12px 0 0;
}

.aligned label,
label {
  color: var(--orch-text);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
}

.help,
p.help,
.form-row .help {
  color: var(--orch-muted);
  font-size: 14px;
  line-height: 1.55;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select,
.vTextField {
  min-height: 40px;
  border-radius: 7px;
  font-size: 15px;
  line-height: 1.45;
}

textarea { min-height: 110px; line-height: 1.55; }

#changelist table,
#changelist .paginator,
#changelist .actions {
  font-size: 14px;
}

#changelist table thead th {
  font-size: 13px;
}

input[type="submit"],
input[type="button"],
.submit-row input,
a.button,
button {
  min-height: 40px;
  padding: 9px 14px;
  font-size: 15px;
}

@media (max-width: 1200px) {
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ブラウザの拡大表示を含む中程度の画面幅では、フィルターを右に固定する。 */
@media (min-width: 768px) and (max-width: 1450px) {
  body:not(.login) #main {
    grid-template-columns: 248px minmax(0, 1fr);
  }
  body #nav-sidebar.admin-navigation {
    width: 248px !important;
    min-width: 248px;
    flex-basis: 248px;
  }
  #changelist-filter {
    position: sticky;
    top: 16px;
    flex: 0 0 210px;
    width: 210px;
    max-height: calc(100vh - 32px);
    margin: 0 0 0 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #changelist-filter h2 {
    padding-top: 9px;
    padding-bottom: 9px;
  }
  #changelist-filter details {
    margin-bottom: 8px;
  }
  #changelist-filter details summary,
  #changelist-filter ul {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 767px) {
  body #header { min-height: auto; }
  #site-name { font-size: 22px; }
  .breadcrumbs { padding: 10px 16px; font-size: 13px; }
  body #user-tools { padding: 8px 14px; }
  /* Django 標準のモバイル用 sidebar 指定より優先する。 */
  body #main {
    display: block !important;
    min-width: 0;
  }
  body #nav-sidebar,
  body #nav-sidebar[aria-expanded="true"] {
    box-sizing: border-box;
    display: block !important;
    width: 100%;
    min-width: 0;
    max-height: none;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--orch-border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  body #nav-sidebar .nav-section {
    margin: 0 0 16px;
  }
  body #nav-sidebar .nav-section h2 {
    margin: 0 10px 8px;
  }
  body #nav-sidebar .nav-section a {
    display: flex;
    min-height: 40px;
    align-items: center;
    margin: 2px 0;
    padding: 8px 10px;
    border: 1px solid var(--orch-border);
    background: var(--orch-surface) !important;
    color: var(--orch-text) !important;
  }
  body #nav-sidebar .nav-home {
    border-color: var(--brand) !important;
    background: var(--brand) !important;
    color: #fff !important;
  }
  body #nav-sidebar .nav-section-admin {
    padding-top: 14px;
    border-top: 1px solid var(--orch-border);
  }
  body #nav-sidebar .nav-menu-disclosure { margin: 0; }
  body #nav-sidebar .nav-menu-disclosure > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid var(--orch-border);
    border-radius: 8px;
    color: var(--orch-text) !important;
    background: var(--orch-surface) !important;
    cursor: pointer;
    font-weight: 700;
  }
  body #nav-sidebar .nav-menu-content { padding-top: 16px; }
  body .toggle-nav-sidebar {
    min-height: 44px;
    padding: 10px 16px;
  }
  body .dashboard #content { width: auto; padding: 22px 16px 34px; }
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  textarea,
  select,
  .vTextField { font-size: 16px; }
  .dashboard-hero { align-items: start; flex-direction: column; }
  .status-grid,
  .quick-action-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 150px; }
  .quick-action { min-height: auto; }
  .dashboard-alert { align-items: start; flex-direction: column; }
}

/* ツールバー（object-tools の追加ボタン等）を少し丸く */
.object-tools a {
  border-radius: 8px !important;
  text-transform: none !important;
  letter-spacing: 0;
  font-weight: 600;
}

/* 追加ボタンは一覧の流れを押し下げず、見出し右上に配置する。 */
.change-list #content {
  position: relative;
}

.change-list #content > h1 {
  min-height: 42px;
  padding-right: 190px;
}

.change-list #content .object-tools {
  position: absolute;
  top: 20px;
  right: 40px;
  display: flex;
  float: none;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

#content .object-tools li {
  float: none;
  margin: 0;
}

#content .object-tools a.addlink {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  background-image: none !important;
}

#content .object-tools a.addlink::before {
  content: '+';
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 767px) {
  .change-list #content > h1 { padding-right: 0; }
  .change-list #content .object-tools {
    position: static;
    margin: 0 0 16px;
  }
}

/* ===== モジュール（セクション）をカード化 ===== */
.module {
  border: 2px solid var(--orch-card-border);
  border-radius: 12px;
  background-clip: padding-box;
  overflow: hidden;
  box-shadow: var(--orch-card-shadow);
}

/* セクション見出し：濃い帯をやめ、淡い面＋左アクセントの落ち着いた見出しに */
.module h2,
.module caption,
.inline-group h2,
.module > table > caption {
  background: var(--orch-h2-bg) !important;
  color: var(--orch-h2-fg) !important;
  border-left: 3px solid var(--brand);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
}
.module h2 a,
.inline-group h2 a,
.module > table > caption a {
  color: var(--orch-h2-fg) !important;
}

/* ===== ボタン（角丸・コンパクト・ブランド色） ===== */
.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  background: var(--button-bg) !important;
  color: var(--primary-fg) !important;
  font-weight: 600;
}

.button:hover,
.button:focus-visible,
input[type="submit"]:hover,
input[type="submit"]:focus-visible,
input[type="button"]:hover,
input[type="button"]:focus-visible,
.submit-row input:hover,
.submit-row input:focus-visible,
a.button:hover,
a.button:focus-visible {
  background: var(--button-hover-bg) !important;
  color: var(--primary-fg) !important;
  border-color: var(--button-hover-bg) !important;
}

.submit-row .deletelink,
.submit-row .deletelink:link,
.submit-row .deletelink:visited {
  border: 1px solid #b3261e !important;
  background: #b3261e !important;
  color: #fff !important;
}

.submit-row .deletelink:hover,
.submit-row .deletelink:focus-visible {
  border-color: #8c1d18 !important;
  background: #8c1d18 !important;
  color: #fff !important;
}

/* ダークテーマではボタン・入力欄を背景から明確に区別する。 */
:root[data-theme="dark"] .button,
:root[data-theme="dark"] input[type="submit"],
:root[data-theme="dark"] input[type="button"],
:root[data-theme="dark"] .submit-row input,
:root[data-theme="dark"] a.button {
  border-color: #8edc96 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

/* 「追加」などの操作ボタンは、ダーク背景で眩しすぎない濃い緑にする。 */
:root[data-theme="dark"] .object-tools a,
:root[data-theme="dark"] a.addlink {
  border-color: #6fb877 !important;
  background: #286d31 !important;
  color: #fff !important;
}

:root[data-theme="dark"] .object-tools a:hover,
:root[data-theme="dark"] .object-tools a:focus-visible,
:root[data-theme="dark"] a.addlink:hover,
:root[data-theme="dark"] a.addlink:focus-visible {
  border-color: #91d598 !important;
  background: #348440 !important;
  color: #fff !important;
}

:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  border-color: #5d7160 !important;
  background: #162119 !important;
  color: #f3faf4 !important;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .button,
  :root[data-theme="auto"] input[type="submit"],
  :root[data-theme="auto"] input[type="button"],
  :root[data-theme="auto"] .submit-row input,
  :root[data-theme="auto"] a.button { border-color: #8edc96 !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
  :root[data-theme="auto"] input[type="text"],
  :root[data-theme="auto"] input[type="password"],
  :root[data-theme="auto"] input[type="email"],
  :root[data-theme="auto"] input[type="url"],
  :root[data-theme="auto"] input[type="number"],
  :root[data-theme="auto"] input[type="date"],
  :root[data-theme="auto"] textarea,
  :root[data-theme="auto"] select { border-color: #5d7160 !important; background: #162119 !important; color: #f3faf4 !important; }
  :root[data-theme="auto"] .object-tools a,
  :root[data-theme="auto"] a.addlink { border-color: #6fb877 !important; background: #286d31 !important; color: #fff !important; }
  :root[data-theme="auto"] .object-tools a:hover,
  :root[data-theme="auto"] .object-tools a:focus-visible,
  :root[data-theme="auto"] a.addlink:hover,
  :root[data-theme="auto"] a.addlink:focus-visible { border-color: #91d598 !important; background: #348440 !important; color: #fff !important; }
}

/* 品種ごとの日常操作と、シーズン全体の操作を混同しないための案内。 */
.admin-guidance {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--orch-border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--brand-tint-2);
  color: var(--orch-text);
}

.admin-guidance p { margin: 0; }
.admin-guidance p + p { margin-top: 7px; color: var(--orch-muted); font-size: 14px; }

/* ===== 一覧・編集フォームの共通仕上げ ===== */
.admin-page-lead {
  margin: -4px 0 22px;
  color: var(--orch-muted);
  font-size: 15px;
}

.change-list #toolbar {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--orch-border);
  border-radius: 10px;
  background: var(--brand-tint-2);
}

.change-list #toolbar #searchbar {
  min-height: 38px;
  border-radius: 7px;
  background: var(--orch-surface);
  color: var(--orch-text);
}

.change-list #toolbar input[type="submit"] {
  min-height: 38px;
  margin-left: 6px;
  border-radius: 7px;
  background: var(--button-bg);
  color: var(--primary-fg);
}

.change-list .actions {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--orch-border);
  background: var(--orch-surface);
}

.change-form #content-main {
  float: none;
  max-width: 980px;
}

/* 注意事項は見出しや本文を確認しやすいよう、空いている横幅を広く使う。 */
body.app-pricing.model-pricinginformation #content {
  width: 100%;
}

/* ===== 操作履歴の詳細: 閲覧専用情報として整理する ===== */
body.app-admin.model-logentry.change-form #content {
  width: min(100%, 920px);
}

body.app-admin.model-logentry.change-form #content-main {
  width: 100%;
  max-width: none;
}

.log-entry-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--orch-border);
}

.log-entry-header h1 {
  margin: 0;
}

.log-entry-header > p:last-child {
  margin: 8px 0 0;
  color: var(--orch-muted);
  font-size: 14px;
}

body.app-admin.model-logentry.change-form fieldset.module {
  margin-bottom: 18px;
}

body.app-admin.model-logentry.change-form .aligned .form-row > div > .flex-container {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

body.app-admin.model-logentry.change-form .aligned label {
  width: auto;
  padding: 0;
  color: var(--orch-muted);
}

body.app-admin.model-logentry.change-form .aligned label + .readonly {
  margin-left: 0;
  color: var(--orch-text);
  font-weight: 650;
}

body.app-admin.model-logentry.change-form .field-change_details .readonly {
  line-height: 1.7;
}

@media (max-width: 767px) {
  body.app-admin.model-logentry.change-form .aligned .form-row > div > .flex-container {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.change-form fieldset.module {
  margin: 0 0 20px;
  background: var(--orch-surface);
}

.change-form fieldset.module .form-row {
  box-sizing: border-box;
  padding: 18px 20px;
  border-bottom: 1px solid var(--orch-border);
}

.change-form fieldset.module .form-row:last-child {
  border-bottom: 0;
}

.change-form .aligned .form-row > div {
  padding: 0;
}

.change-form .readonly {
  color: var(--orch-muted);
}

.change-form .submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--orch-border);
  border-radius: 12px;
  background: var(--orch-surface);
  box-shadow: var(--orch-card-shadow);
}

.change-form .submit-row input {
  margin: 0 !important;
}

/* CKEditor 5 も入力欄と同じ面・角丸・フォーカス表現にそろえる。 */
.change-form .ck.ck-editor {
  overflow: hidden;
  border: 1px solid var(--orch-border);
  border-radius: 9px;
}

.change-form .ck.ck-toolbar {
  border: 0 !important;
  border-bottom: 1px solid var(--orch-border) !important;
  background: var(--brand-tint-2) !important;
}

.change-form .ck.ck-editor__main > .ck-editor__editable {
  min-height: 200px;
  border: 0 !important;
  background: var(--orch-surface) !important;
  color: var(--orch-text) !important;
}

:root[data-theme="dark"] .change-form .ck.ck-toolbar {
  background: #1b2b1e !important;
}

:root[data-theme="dark"] .change-form .ck.ck-editor__main > .ck-editor__editable {
  background: #162119 !important;
  color: #f3faf4 !important;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .change-form .ck.ck-toolbar { background: #1b2b1e !important; }
  :root[data-theme="auto"] .change-form .ck.ck-editor__main > .ck-editor__editable { background: #162119 !important; color: #f3faf4 !important; }
}

@media (max-width: 767px) {
  .admin-page-lead { margin-bottom: 18px; font-size: 14px; }
  .change-form fieldset.module .form-row { padding: 15px 14px; }
  .change-form .submit-row { padding: 12px; }
  .change-form .submit-row input { width: 100%; }
  .change-list #toolbar { padding: 10px; }
}
.submit-row {
  border-radius: 0 0 12px 12px;
}

/* ===== 入力フォーカスをブランド色のリングに ===== */
input:focus,
select:focus,
textarea:focus,
.vTextField:focus {
  outline: none !important;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15) !important;
}

/* ===== テーブルの可読性を少し向上 ===== */
#changelist table thead th {
  text-transform: none;
  letter-spacing: 0;
}

/* ===== changelist の furigana 入力幅を抑制（既存仕様を維持） ===== */
body.app-pears.model-pearvariety.change-list
  .results
  td.field-furigana
  input[type="text"] {
  width: 10ch !important;
  min-width: 8ch !important;
  max-width: 12ch !important;
}

/* ===== 休業日一覧: 休業期間列を読みやすい幅にする ===== */
body.app-orchards.model-orchardholidayrange.change-list
  .results
  th.column-period_display,
body.app-orchards.model-orchardholidayrange.change-list
  .results
  td.field-period_display {
  min-width: 16ch;
  white-space: nowrap;
}
