.dahlia-grid {
  display: grid;
  gap: 26px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.dahlia-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: 215px minmax(150px, 1fr) auto;
  min-height: 430px;
  overflow: hidden;
}

.card-image {
  background: #eef2ec;
  display: block;
  height: 215px;
  min-height: 215px;
}

.card-image img,
.thumb-cell img,
.detail-image img,
.gallery-grid img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.dahlia-card h2 {
  font-size: 1.08rem;
  line-height: 1.25;
  margin: 0 0 8px;
}

.dahlia-card h2,
.dahlia-card-specs dt,
.dahlia-card-specs dd {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.dahlia-card .card-body {
  display: flex;
  flex-direction: column;
  min-height: 150px;
  padding: 14px;
}

.dahlia-card-specs {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin: auto 0 0;
}

.dahlia-card-specs div {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dahlia-card-specs dt {
  color: #59665d;
  font-size: .82rem;
  font-weight: 700;
  min-width: 86px;
}

.dahlia-card-specs dd {
  font-weight: 600;
  margin: 0;
  max-width: 58%;
  text-align: right;
}

.dahlia-card-footer {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 16px;
}

.image-placeholder {
  align-items: center;
  background: #eef2ec;
  color: #7a867d;
  display: flex;
  font-size: 2rem;
  height: 100%;
  justify-content: center;
  min-height: 215px;
  width: 100%;
}

.thumb-cell {
  height: 72px;
  width: 92px;
}

.thumb-cell img {
  border-radius: 6px;
}

.dahlia-table-panel {
  padding: 0;
}

.dahlia-table {
  min-width: 920px;
}

.dahlia-table th {
  color: #59665d;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.dahlia-table td {
  vertical-align: middle;
}

.dahlia-table-image {
  width: 92px;
}

.table-thumb {
  align-items: center;
  background: #eef2ec;
  border-radius: 7px;
  color: #7a867d;
  display: flex;
  height: 64px;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
  width: 82px;
}

.table-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.table-thumb-empty {
  font-size: 1.45rem;
}

.dahlia-table-title {
  color: var(--bs-body-color);
  font-weight: 700;
  text-decoration: none;
}

.dahlia-table-title:hover {
  color: var(--garden);
}

.dahlia-table-subtitle {
  color: #59665d;
  display: block;
  font-size: .88rem;
  margin-top: 2px;
}

.table-text-clamp {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-width: 220px;
  overflow: hidden;
}

.detail-hero {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 520px) 1fr;
}

.detail-title-row {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.detail-title-row h1 {
  margin-bottom: 4px;
}

.detail-neighbor-nav {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
}

.detail-neighbor-nav .btn {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.detail-action-row {
  flex: 1 1 auto;
  justify-content: flex-start;
  row-gap: 8px;
}

.detail-action-row .btn {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

.detail-summary > .rich-text-output {
  margin-top: 18px;
}

.detail-bottom-actions {
  align-items: center;
  background: #fff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px;
}

.detail-delete-form {
  flex: 0 0 auto;
  margin: 0;
}

.detail-delete-form .btn {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

.detail-position-meta {
  color: #59665d;
  font-size: .86rem;
  font-weight: 700;
  margin: -6px 0 12px;
}

.dahlia-print-sheet {
  display: none;
}

.detail-image {
  aspect-ratio: 4 / 3;
  background: #eef2ec;
  border-radius: 8px;
  overflow: hidden;
}

.rich-text-source {
  display: none;
}

.rich-text-editor {
  background: #fff;
  display: block;
  height: auto;
  margin: 0;
  min-height: 0;
  position: relative;
  width: 100%;
}

.rich-text-source + .ql-toolbar.ql-snow {
  border-color: var(--line);
  border-radius: 8px 8px 0 0;
}

.rich-text-editor.ql-container.ql-snow {
  border-color: var(--line);
  border-radius: 0 0 8px 8px;
  font-family: inherit;
  font-size: 1rem;
  height: auto;
  min-height: 0;
  position: relative;
}

.rich-text-editor .ql-editor {
  height: auto;
  max-height: none;
  min-height: var(--rich-text-min-height, 90px);
  overflow-y: hidden;
  padding: 10px 14px;
}

.rich-text-output > :last-child,
.rich-text-output blockquote:last-child,
.rich-text-output ul:last-child,
.rich-text-output ol:last-child {
  margin-bottom: 0;
}

.rich-text-output blockquote {
  border-left: 3px solid var(--garden);
  color: #59665d;
  margin: 0 0 1rem;
  padding-left: 12px;
}

.image-preview-trigger {
  background: transparent;
  border: 0;
  cursor: zoom-in;
  display: block;
  height: 100%;
  padding: 0;
  width: 100%;
}

.image-preview-trigger:focus-visible {
  outline: 3px solid rgb(84 115 93 / 55%);
  outline-offset: -3px;
}

.spec-table th {
  color: #59665d;
  width: 180px;
}

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

.inventory-grid div {
  background: #f6f7f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.inventory-label {
  color: #59665d;
  display: block;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.inventory-grid strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.2;
}

.gallery-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.gallery-grid figure {
  margin: 0;
}

.gallery-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.gallery-image-wrap {
  aspect-ratio: 1;
  background: #eef2ec;
  position: relative;
}

.gallery-grid img {
  aspect-ratio: 1;
  display: block;
}

.gallery-primary-badge {
  align-items: center;
  background: rgb(33 83 62 / 92%);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  gap: 4px;
  left: 10px;
  padding: 5px 8px;
  position: absolute;
  top: 10px;
}

.gallery-item figcaption {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.form-image-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 14px;
}

.form-image-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  overflow: hidden;
}

.form-image-wrap {
  aspect-ratio: 4 / 3;
  background: #eef2ec;
  position: relative;
}

.form-image-wrap img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.form-image-card figcaption {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.form-image-card .btn {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  justify-content: center;
  width: 100%;
}

.image-preview-modal .modal-body {
  background: #111;
  padding: 0;
}

.image-preview-full {
  display: block;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  width: 100%;
}

.image-upload-status {
  align-items: center;
  color: #59665d;
  display: flex;
  font-size: .9rem;
  gap: 8px;
  margin-top: 8px;
}

.image-upload-status[hidden] {
  display: none !important;
}

.image-upload-status .spinner-border {
  border-width: .16em;
  height: 1rem;
  width: 1rem;
}

.image-upload-status.is-loading {
  color: #35483b;
  font-weight: 700;
}

.timeline-item {
  border-left: 3px solid var(--garden);
  margin-bottom: 12px;
  padding-left: 12px;
}

.tag-box {
  max-height: 160px;
  overflow: auto;
}

.import-row + .import-row {
  margin-top: 16px;
}

.action-select {
  max-width: 220px;
}

.warning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 14px;
}

.sticky-actions {
  background: rgb(248 247 243 / 90%);
  bottom: 0;
  padding: 12px 0;
  position: sticky;
}

.dahlia-search-card {
  margin-bottom: 18px;
}

.dahlia-search-card h2 {
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.dahlia-filter-actions {
  justify-content: flex-start;
}

.mobile-filter-panel {
  display: none;
}

.mobile-filter-panel summary {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #304238;
  cursor: pointer;
  display: flex;
  font-weight: 800;
  justify-content: space-between;
  list-style: none;
  margin-bottom: 12px;
  min-height: 48px;
  padding: 10px 12px;
}

.mobile-filter-panel summary::-webkit-details-marker {
  display: none;
}

.mobile-filter-panel summary span:first-child {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.mobile-filter-meta {
  background: #eef2ec;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #59665d;
  font-size: .78rem;
  font-weight: 800;
  padding: 4px 8px;
}

.mobile-filter-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 12px;
}

.dahlia-overview-controls {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 18px;
}

.dahlia-view-toggle .btn {
  align-items: center;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 44px;
}

.dahlia-view-toggle .btn.active {
  background: var(--garden);
  border-color: var(--garden);
  color: #fff;
}

.dahlia-sort-control {
  align-items: center;
  display: flex;
  gap: 10px;
}

.dahlia-sort-control .form-label {
  color: #59665d;
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
}

.dahlia-sort-control .form-select {
  min-width: 210px;
}

.spec-form-grid {
  display: grid;
  gap: 16px;
}

.spec-form-columns {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.spec-form-group {
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 14px;
}

.spec-form-group legend {
  color: #35483b;
  float: none;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  margin: -2px 0 14px 8px;
  padding: 0 10px;
  width: auto;
}

.spec-form-group .form-label {
  color: #59665d;
  font-size: .86rem;
  font-weight: 700;
}

.light-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.import-column-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-column-list span {
  background: #eef2ec;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #304238;
  font-size: .86rem;
  font-weight: 700;
  padding: 6px 10px;
}

.result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a4-select-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.a4-select-card {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
}

.a4-select-card strong,
.a4-select-card small {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.a4-select-card small {
  color: #59665d;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-neighbor-nav {
    justify-content: flex-end;
  }

  .detail-position-meta {
    display: none;
  }

  .spec-form-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .desktop-filter-panel {
    display: none;
  }

  .mobile-filter-panel {
    display: block;
  }
}

@media (max-width: 520px) {
  .dahlia-filter-actions .btn {
    flex: 1 1 100%;
  }

  .dahlia-overview-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .dahlia-view-toggle,
  .dahlia-sort-control,
  .dahlia-sort-control .form-select {
    width: 100%;
  }

  .dahlia-view-toggle .btn {
    flex: 1 1 0;
  }

  .dahlia-sort-control {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .detail-neighbor-nav .btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .detail-action-row .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .detail-bottom-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-delete-form .btn {
    justify-content: center;
    width: 100%;
  }

  .dahlia-card {
    grid-template-rows: 200px minmax(150px, 1fr) auto;
    min-height: 420px;
  }

  .dahlia-grid {
    gap: 32px;
  }

  .dahlia-card-footer {
    padding: 16px 14px;
  }

  .card-image,
  .image-placeholder {
    height: 200px;
    min-height: 200px;
  }

  .inventory-grid {
    grid-template-columns: 1fr;
  }
}
