:root {
  --bg-page: #f7f5f0;
  --bg-surface: #ffffff;
  --bg-subtle: #efece4;
  --bg-hover: #f2efe7;
  --text-main: #2a2520;
  --text-muted: #6e655b;
  --border-color: #e2ddd2;
  --accent-primary: #2b5b46;
  --accent-primary-hover: #214736;
  --accent-primary-soft: #e6f0eb;
  --accent-amber: #c86d3b;
  --accent-amber-soft: #f9ebe2;
  --accent-gold: #d49b27;
  --accent-gold-soft: #fbf4e1;
  --danger: #b8423b;
  --danger-soft: #fbeceb;
  --shadow-sm: 0 2px 6px rgba(42, 37, 32, 0.06);
  --shadow-md: 0 6px 18px rgba(42, 37, 32, 0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', system-ui, sans-serif;
  --font-serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'MS PMincho', Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-primary);
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.size-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.size-switcher-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 6px 0 4px;
}

.size-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

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

.size-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.app-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

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

.nav-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--accent-primary);
  color: #fff;
}

.nav-badge-amber {
  background: var(--accent-amber);
}

/* Main Content */
.app-main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

.loading-box,
.empty-box,
.error-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
}

.error-box {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e6b8b5;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
}

.btn-amber {
  background: var(--accent-amber);
  color: #fff;
}

.btn-amber:hover:not(:disabled) {
  background: #b15c2d;
}

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: #e2b4b1;
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #f5d8d6;
}

.btn-star {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn-star.active {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  color: #9e6e0a;
}

/* Toolbar & Tabs */
.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.view-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.view-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.genre-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.genre-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.genre-tab:hover {
  border-color: var(--accent-primary);
  color: var(--text-main);
}

.genre-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.genre-count {
  font-size: 0.74rem;
  opacity: 0.85;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.92rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
}

.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(43, 91, 70, 0.12);
}

/* Sections */
.section-block {
  margin-bottom: 28px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.section-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Book Grid & Size Variants */
.book-grid {
  display: grid;
  align-items: start;
}

.grid-size-small {
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 12px;
}

.grid-size-medium {
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 16px;
}

.grid-size-large {
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 20px;
}

@media (max-width: 520px) {
  .grid-size-small {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .grid-size-medium {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .grid-size-large {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* Cover Typography & Image */
.cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-subtle);
  box-shadow: 0 4px 10px rgba(42, 37, 32, 0.14);
  transition: filter 0.2s, opacity 0.2s, transform 0.15s;
}

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

.typo-cover {
  width: 100%;
  height: 100%;
  padding: 10px 10px 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  color: #fff;
  user-select: none;
}

.typo-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.24) 0, rgba(255, 255, 255, 0.1) 6px, transparent 14px);
  pointer-events: none;
}

.typo-cover::after {
  content: '';
  position: absolute;
  inset: 6px 6px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  pointer-events: none;
}

.typo-theme-0 { background: linear-gradient(155deg, #2b5b46, #1b3b2d); }
.typo-theme-1 { background: linear-gradient(155deg, #2d4c6e, #1a2e45); }
.typo-theme-2 { background: linear-gradient(155deg, #7c3f34, #4d221b); }
.typo-theme-3 { background: linear-gradient(155deg, #6b5335, #43331e); }
.typo-theme-4 { background: linear-gradient(155deg, #4b4368, #2d2742); }
.typo-theme-5 { background: linear-gradient(155deg, #3c5f63, #233c40); }

.typo-cover-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  z-index: 1;
}

.typo-genre {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.95);
}

.typo-vol {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.typo-cover-body {
  z-index: 1;
  margin: auto 0;
  padding: 4px 2px;
}

.typo-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.grid-size-small .typo-title {
  font-size: 0.78rem;
  -webkit-line-clamp: 3;
}

.grid-size-large .typo-title {
  font-size: 1.08rem;
}

.typo-author {
  z-index: 1;
  font-size: 0.72rem;
  opacity: 0.88;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Series & Book Cards on Shelf */
.shelf-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
  position: relative;
}

.shelf-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #c8c0b1;
}

.series-stack {
  position: relative;
  padding-right: 7px;
}

.series-stack::before,
.series-stack::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 0 6px 6px 0;
  background: #dfd9cc;
  border: 1px solid #cbc3b3;
  border-left: none;
}

.series-stack::before {
  right: 3px;
  left: 10px;
  z-index: 0;
}

.series-stack::after {
  right: 0;
  top: 8px;
  bottom: 8px;
  left: 14px;
  background: #ebe6db;
  z-index: -1;
}

.series-stack .cover-frame {
  position: relative;
  z-index: 1;
}

.card-badges-top {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  z-index: 3;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-fav {
  background: rgba(255, 250, 232, 0.95);
  color: #a16b08;
  border: 1px solid var(--accent-gold);
}

.badge-done {
  background: rgba(230, 240, 235, 0.95);
  color: var(--accent-primary);
  border: 1px solid #a8cbb9;
}

.badge-owned {
  background: var(--accent-primary);
  color: #fff;
}

.badge-unowned {
  background: var(--accent-amber);
  color: #fff;
}

.badge-latest {
  background: #234938;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}

.badge-upcoming {
  background: var(--accent-amber-soft);
  color: #9b471b;
  border: 1px dashed var(--accent-amber);
}

.badge-genre {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.grid-size-small .card-title {
  font-size: 0.8rem;
}

.card-author {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-status-pill {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  text-align: center;
  line-height: 1.35;
}

.series-status-pill.has-unowned {
  background: var(--accent-amber-soft);
  color: #9e4518;
}

/* Single book unowned visual */
.shelf-card.book-unowned .cover-frame {
  filter: grayscale(58%) brightness(0.84) contrast(0.92);
  opacity: 0.54;
}

/* Series Detail */
.series-detail-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.series-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.series-detail-title {
  margin: 8px 0 4px;
  font-size: 1.45rem;
  font-weight: 700;
}

.series-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.series-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  min-width: 180px;
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.volume-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
  position: relative;
}

.volume-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.volume-card.is-owned {
  border-color: #b5d2c4;
}

.volume-card.is-unowned .cover-frame {
  filter: grayscale(58%) brightness(0.84) contrast(0.92);
  opacity: 0.54;
}

.volume-card.is-upcoming {
  border: 2px dashed var(--accent-amber);
  background: #fffcf8;
}

.volume-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 2px;
}

.volume-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.volume-tap-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.volume-mini-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 2px 6px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Releases & Shopping List */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.list-row.is-upcoming-row {
  border: 1.5px dashed var(--accent-amber);
  background: #fffcf8;
}

.list-thumb {
  width: 52px;
  flex-shrink: 0;
}

.list-thumb .typo-cover {
  padding: 5px 5px 5px 7px;
}

.list-thumb .typo-genre,
.list-thumb .typo-author {
  display: none;
}

.list-thumb .typo-title {
  font-size: 0.56rem;
  -webkit-line-clamp: 3;
}

.list-body {
  flex: 1;
  min-width: 0;
}

.list-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.list-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.list-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.price-text {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  min-width: 72px;
  text-align: right;
}

@media (max-width: 640px) {
  .list-row {
    flex-wrap: wrap;
  }
  .list-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--bg-subtle);
  }
}

.summary-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.summary-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.summary-stat-value {
  margin-top: 4px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.summary-stat-value.amber {
  color: var(--accent-amber);
}

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

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.86rem;
  font-weight: 600;
}

.author-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 2px;
}

.author-chip-remove:hover {
  color: var(--danger);
}

/* Add Book Page */
.add-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
  align-items: start;
}

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

.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sub-tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.sub-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

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

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  cursor: pointer;
  background: var(--bg-surface);
}

.radio-pill:has(input:checked) {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  font-weight: 700;
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
  margin-top: 12px;
}

.candidate-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  align-items: center;
}

.candidate-card:hover {
  border-color: var(--accent-primary);
}

.preview-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  margin-bottom: 14px;
}

.preview-cover {
  width: 82px;
  flex-shrink: 0;
}

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(25, 22, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* Toast */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: #2a2520;
  color: #fff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
}

.toast.toast-error {
  background: var(--danger);
}

.toast-action {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* Bulk Series Preview & Assembly */
.bulk-alert {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 0.9rem;
}

.bulk-alert-warn {
  background: var(--accent-amber-soft);
  border-color: #e4b596;
  color: #7d3612;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.bulk-toolbar-summary {
  font-size: 0.88rem;
  color: var(--text-main);
}

.bulk-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bulk-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 2px;
}

.bulk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: opacity 0.15s, background-color 0.15s, border-color 0.15s;
}

.bulk-row.is-excluded {
  opacity: 0.56;
  background: var(--bg-page);
}

.bulk-row.is-registered {
  background: #f5f3ed;
  border-style: dashed;
  opacity: 0.72;
}

.bulk-row-check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.bulk-row-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.bulk-vol-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.bulk-vol-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.bulk-vol-input {
  width: 70px;
  padding: 6px 6px;
  text-align: center;
  font-weight: 700;
}

.bulk-vol-input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.bulk-row-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.owned-toggle-btn {
  min-width: 72px;
  background: var(--accent-amber-soft);
  border-color: #e4b596;
  color: #9e4518;
}

.owned-toggle-btn.is-owned {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.bulk-submit-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.badge-unknown {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #e6b8b5;
}

.badge-special {
  background: var(--accent-gold-soft);
  color: #966306;
  border: 1px solid #e4c67a;
}

.badge-duplicate {
  background: var(--accent-amber-soft);
  color: #9b471b;
  border: 1px solid #e4b596;
}

.badge-registered {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid #a6cbb9;
}

@media (max-width: 640px) {
  .bulk-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .bulk-row .list-body {
    flex-basis: calc(100% - 170px);
    min-width: 180px;
  }
  .bulk-row-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--bg-subtle);
  }
}
