* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: sans-serif;
  padding: 20px;
  padding-top: 68px;
  background-color: #f5f5f5;
  overflow-x: hidden;
  max-width: 100vw;
}
/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.navbar-inner {
  display: flex;
  align-items: center;
  max-width: 100%;
  padding: 0 20px;
  height: 48px;
  gap: 16px;
}
.navbar-links {
  flex: 1;
  display: flex;
  gap: 4px;
  min-width: 0;
}
.navbar-spacer {
  flex: 1;
}
.navbar-menu {
  display: none;
}
.navbar-brand {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 16px;
  color: #333;
  text-decoration: none;
}
.navbar-link {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 14px;
  color: #555;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s;
}
.navbar-link:hover {
  background: #f0f0f0;
}
.navbar-link.active {
  background: #e7f3ff;
  color: #0969da;
  font-weight: 600;
}
.navbar-menu-login {
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.member-nav {
  display: flex;
  align-items: center;
}
.member-auth-btn {
  min-width: 72px;
  height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  color: #24292f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.member-auth-btn:hover {
  background: #f6f8fa;
}
/* Cart toggle button */
.cart-toggle-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: white;
  color: #555;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.cart-toggle-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-block;
  background: #dc3545;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  border-radius: 9px;
}
/* ===== Cart Drawer (Shopify-style) ===== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.cart-drawer.open {
  transform: translateX(0);
}
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eaeef2;
  flex-shrink: 0;
}
.cart-drawer-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 0;
}
.cart-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
}
.cart-drawer-close:hover {
  background: #f0f0f0;
}
.cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.cart-drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eaeef2;
  gap: 10px;
}
.cart-drawer-item:last-child {
  border-bottom: none;
}
.cart-drawer-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.cart-drawer-item-img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.cart-drawer-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cart-drawer-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-drawer-item-price {
  font-size: 12px;
  color: #666;
}
.cart-drawer-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.cart-drawer-qty {
  display: flex;
  align-items: center;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
}
.cart-drawer-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #f6f8fa;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-drawer-qty-btn:hover {
  background: #e9ecef;
}
.cart-drawer-qty-value {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}
.cart-drawer-remove {
  border: none;
  background: none;
  font-size: 11px;
  color: #dc3545;
  cursor: pointer;
  padding: 2px 4px;
}
.cart-drawer-remove:hover {
  text-decoration: underline;
}
.cart-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid #eaeef2;
  flex-shrink: 0;
}
.cart-drawer-simulate-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #0969da;
  color: white;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.cart-drawer-simulate-btn:hover {
  background: #0757b5;
}
/* ===== Container ===== */
.container {
  max-width: 100%;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  width: 100%;
}
h1 {
  margin-bottom: 20px;
  color: #333;
}
.cards-page-title {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.25;
}
h2 {
  color: #333;
  font-size: 16px;
  margin-bottom: 12px;
}
.controls {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}
.clear-all-btn {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f8f9fa;
  color: #666;
  cursor: pointer;
}
.clear-all-btn:hover {
  background: #e9ecef;
  border-color: #999;
}
/* テーブルスクロールコンテナ */
.table-wrapper {
  overflow: auto;
  max-height: calc(100vh - 260px);
}
table {
  width: 100%;
  min-width: 1300px;
  border-collapse: separate;
  border-spacing: 0;
}
/* ヘッダー固定（縦スクロール） */
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #f8f9fa;
}
th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  cursor: pointer;
  user-select: none;
}
th:hover {
  background-color: #e9ecef;
}
th.sortable .th-title::after {
  content: " ↕";
  opacity: 0.5;
  font-size: 0.8em;
}
th.sort-asc .th-title::after {
  content: " ↑";
  opacity: 1;
}
th.sort-desc .th-title::after {
  content: " ↓";
  opacity: 1;
}
td {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
}
tr:hover {
  background-color: #f8f9fa;
}
/* カード名列固定（横スクロール） */
th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 200px;
  max-width: 200px;
  width: 200px;
}
td:first-child {
  background-color: white;
}
/* 画像列固定（横スクロール） */
th:nth-child(2),
td:nth-child(2) {
  position: sticky;
  left: 200px;
  z-index: 1;
  min-width: 84px;
  width: 84px;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}
td:nth-child(2) {
  background-color: white;
}
/* 操作列固定（横スクロール時も常に見える） */
#cardTable th:last-child,
#cardTable td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 176px;
  width: 176px;
}
#cardTable thead th:last-child {
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(248, 249, 250, 0.78) 0%, #f8f9fa 18%),
    #f8f9fa;
  box-shadow: -1px 0 0 #d8dee4;
}
#cardTable td:last-child {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.98) 24%),
    #fff;
  box-shadow: -1px 0 0 #e5e9ef, -18px 0 24px rgba(15, 23, 42, 0.04);
}
/* ヘッダー × 固定列の交差セル（最高z-index） */
thead th:first-child,
thead th:nth-child(2) {
  z-index: 3;
}
/* ホバー時の背景色を維持 */
tr:hover td:first-child,
tr:hover td:nth-child(2) {
  background-color: #f8f9fa;
}
#cardTable tr:hover td:last-child {
  background:
    linear-gradient(90deg, rgba(248, 249, 250, 0.9) 0%, rgba(248, 249, 250, 0.98) 24%),
    #f8f9fa;
}
.card-img {
  width: 60px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
}
.card-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price {
  text-align: right;
}
.price-negative {
  color: #dc3545;
}
.ratio {
  text-align: right;
}
/* ===== Member auth ===== */
.member-auth-page {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: #f6f8fa;
}
.member-auth-card {
  width: min(420px, 100%);
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(31, 35, 40, 0.12);
}
.member-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 58px 18px 18px;
  background: rgba(31, 35, 40, 0.24);
}
.member-auth-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: transparent;
  cursor: default;
}
.member-auth-dialog {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(31, 35, 40, 0.18);
}
.member-auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #eaeef2;
}
.member-auth-header h1,
.member-auth-header h2 {
  font-size: 16px;
  line-height: 1.4;
}
.member-auth-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #656d76;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.member-auth-close:hover {
  background: #f6f8fa;
  color: #24292f;
}
.member-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
}
.member-panel.signed-in {
  background: #f6f8fa;
}
.member-panel.signed-in div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.member-panel.signed-in span {
  color: #656d76;
  font-size: 12px;
}
.member-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(
      140px,
      1fr
    ) minmax(110px, 0.8fr);
  gap: 8px;
  flex: 1;
}
.member-input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  color: #24292f;
  font-size: 14px;
}
.member-input-label {
  display: grid;
  gap: 6px;
}
.member-input-label span {
  color: #24292f;
  font-size: 13px;
  font-weight: 700;
}
.member-otp-input {
  font-variant-numeric: tabular-nums;
}
.member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.member-primary-btn,
.member-secondary-btn,
.favorite-filter-btn {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.member-primary-btn {
  border-color: #1f6feb;
  background: #1f6feb;
  color: #fff;
}
.member-primary-btn:hover {
  background: #1158c7;
}
.member-primary-btn:disabled {
  border-color: #d0d7de;
  background: #8c959f;
  color: #fff;
  cursor: not-allowed;
}
.member-secondary-btn,
.favorite-filter-btn {
  background: #fff;
  color: #24292f;
}
.member-secondary-btn:hover,
.favorite-filter-btn:hover:not(:disabled) {
  background: #f6f8fa;
}
.favorite-filter-btn.active {
  border-color: #bf8700;
  background: #fff8c5;
  color: #7d4e00;
}
.favorite-filter-btn:disabled {
  color: #8c959f;
  cursor: not-allowed;
}
.member-error {
  color: #cf222e;
  font-size: 13px;
  font-weight: 600;
}
.member-notice {
  color: #57606a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
.member-auth-dialog .member-panel,
.member-auth-card .member-panel {
  align-items: stretch;
  flex-direction: column;
  margin: 0;
  border: none;
  border-radius: 0;
}
.member-auth-card .member-fields,
.member-auth-dialog .member-fields {
  grid-template-columns: 1fr;
}
.member-auth-card .member-actions,
.member-auth-dialog .member-actions {
  justify-content: flex-end;
}
.member-privacy-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #57606a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}
.member-privacy-consent input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
}
.member-privacy-consent a {
  color: #0969da;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.profile-page {
  max-width: 560px;
}
.profile-lead {
  margin-bottom: 16px;
  color: #656d76;
  font-size: 14px;
  line-height: 1.7;
}
.profile-form {
  display: grid;
  gap: 14px;
}
.profile-field {
  display: grid;
  gap: 6px;
}
.profile-field span {
  color: #24292f;
  font-size: 13px;
  font-weight: 700;
}
.profile-field input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  color: #24292f;
  font-size: 14px;
}
.profile-field input:disabled {
  background: #f6f8fa;
  color: #656d76;
}
.policy-page {
  max-width: 880px;
}
.policy-header {
  border-bottom: 1px solid #eaeef2;
  margin-bottom: 24px;
  padding-bottom: 20px;
}
.policy-kicker {
  margin-bottom: 8px;
  color: #0969da;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.policy-lead,
.policy-date,
.policy-section p {
  color: #57606a;
  line-height: 1.8;
}
.policy-lead {
  max-width: 680px;
  font-size: 15px;
}
.policy-date {
  margin-top: 10px;
  font-size: 13px;
}
.policy-sections {
  display: grid;
  gap: 22px;
}
.policy-section {
  display: grid;
  gap: 8px;
}
.policy-section h2 {
  margin: 0;
  color: #24292f;
  font-size: 17px;
}
.policy-section p {
  font-size: 14px;
}
.app-footer {
  padding: 14px 0 0;
  text-align: center;
}
.app-footer a {
  color: #57606a;
  font-size: 12px;
  text-decoration: none;
}
.app-footer a:hover {
  text-decoration: underline;
}
/* ===== Quote cart stepper ===== */
.action-header {
  text-align: center;
  color: #24292f;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.action-cell {
  width: 228px;
  padding-left: 12px;
  text-align: center;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.favorite-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  background: #fff;
  color: #6e7781;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.favorite-btn:hover {
  border-color: #bf8700;
  background: #fff8c5;
  color: #9a6700;
}
.favorite-btn.active {
  border-color: #bf8700;
  background: #fff8c5;
  color: #bf8700;
}
.cart-stepper {
  display: grid;
  grid-template-columns: 34px minmax(84px, 1fr) 34px;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid #d0d7de;
  border-radius: 15px;
  background: #fff;
  box-shadow:
    0 1px 0 rgba(27, 31, 36, 0.04),
    0 8px 24px rgba(140, 149, 159, 0.12);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}
.cart-stepper:hover {
  transform: translateY(-1px);
  border-color: #afb8c1;
  box-shadow:
    0 1px 0 rgba(27, 31, 36, 0.04),
    0 12px 28px rgba(140, 149, 159, 0.16);
}
.cart-stepper.in-cart {
  border-color: rgba(9, 105, 218, 0.28);
  box-shadow:
    0 1px 0 rgba(9, 105, 218, 0.08),
    0 12px 28px rgba(9, 105, 218, 0.12);
}
.cart-stepper-status {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 0 4px;
  border: 1px solid #eaeef2;
  border-radius: 11px;
  background: #f6f8fa;
}
.cart-stepper-status-count {
  color: #24292f;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cart-stepper-status-unit {
  color: #656d76;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}
.cart-stepper.in-cart .cart-stepper-status {
  border-color: rgba(9, 105, 218, 0.12);
  background: rgba(221, 244, 255, 0.45);
}
.cart-stepper.in-cart .cart-stepper-status-unit {
  color: #0969da;
}
.cart-stepper-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  background: #fff;
  color: #57606a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.04);
}
.cart-stepper-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(140, 149, 159, 0.14);
}
.cart-stepper-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.cart-stepper-btn-dec:hover:not(:disabled) {
  border-color: #afb8c1;
  background: #f6f8fa;
  color: #24292f;
}
.cart-stepper-btn-inc {
  border-color: #1f6feb;
  background: #1f6feb;
  color: white;
}
.cart-stepper-btn-inc:hover:not(:disabled) {
  border-color: #1158c7;
  background: #1158c7;
  color: white;
}
/* レンジフィルター */
.range-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.range-filter input {
  width: 60px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: right;
}
.range-filter input:focus {
  outline: none;
  border-color: #007bff;
}
.range-filter input.has-value {
  background-color: #e7f3ff;
  border-color: #007bff;
}
.range-separator {
  color: #666;
  font-size: 12px;
}
/* スピンボタンを非表示 */
.range-filter input::-webkit-outer-spin-button,
.range-filter input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.range-filter input[type="number"] {
  -moz-appearance: textfield;
}
/* ===== Simulation page ===== */
.sim-manual-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sim-note-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #f6f8fa;
}
.sim-note-card strong {
  font-size: 13px;
  color: #1f2328;
}
.sim-note-card span {
  font-size: 12px;
  color: #59636e;
}
.sim-settings {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.sim-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.sim-setting-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sim-setting-item-wide {
  grid-column: 1 / -1;
}
.sim-setting-item label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}
.sim-input {
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 14px;
}
.sim-input:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}
.sim-helper-text {
  font-size: 12px;
  color: #656d76;
  line-height: 1.4;
}
.sim-settings-note {
  margin: 0 0 12px;
  color: #57606a;
  font-size: 13px;
  line-height: 1.5;
}
.sim-logic-panel,
.cart-item-logic-panel {
  margin: 16px 0;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}
.sim-logic-panel summary,
.cart-item-logic-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  background: #f6f8fa;
  color: #1f2328;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.sim-logic-panel summary:hover,
.cart-item-logic-panel summary:hover {
  background: #eef2f7;
}
.sim-logic-panel[open] summary,
.cart-item-logic-panel[open] summary {
  border-bottom: 1px solid #d8dee4;
}
.sim-logic-content,
.cart-item-logic-content {
  display: grid;
  gap: 14px;
  padding: 14px;
}
.sim-logic-section {
  padding: 12px;
  border: 1px solid #eaeef2;
  border-radius: 8px;
  background: #fbfcfe;
}
.sim-logic-title {
  margin: 0 0 10px;
  color: #24292f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}
.sim-logic-formula {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #ffffff;
  color: #24292f;
  font-family: ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
}
.sim-logic-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff8c5;
  color: #57606a;
  font-size: 13px;
  line-height: 1.5;
}
.sim-setting-item select {
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}
/* Mode toggle */
.sim-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.sim-mode-toggle-top {
  margin-bottom: 24px;
}
.sim-mode-btn {
  padding: 8px 16px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.sim-mode-btn.active {
  background: #0969da;
  border-color: #0969da;
  color: white;
}
.bulk-settings {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.bulk-settings-intro {
  display: block;
  margin-bottom: 12px;
  color: #78350f;
}
.bulk-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.bulk-settings-mockup {
  background: white;
  border: 1px solid #d0d7de;
}
.bulk-settings-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.5;
}
.bulk-purpose-toggle {
  margin-bottom: 16px;
}
.sim-fixed-value {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa;
  color: #24292f;
  font-size: 14px;
  font-weight: 700;
}
.bulk-summary-card {
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #d0d7de;
}
.bulk-summary-card-good {
  background: #f0fdf4;
  border-color: #86efac;
}
.bulk-summary-card-warning {
  background: #fffbeb;
  border-color: #fcd34d;
}
.bulk-summary-card-danger {
  background: #fef2f2;
  border-color: #fca5a5;
}
.bulk-summary-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
}
.bulk-summary-card-good .bulk-summary-title {
  color: #15803d;
}
.bulk-summary-card-warning .bulk-summary-title {
  color: #b45309;
}
.bulk-summary-card-danger .bulk-summary-title {
  color: #b91c1c;
}
.bulk-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.bulk-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-summary-meta {
  margin: 16px 0 0;
  font-size: 13px;
  color: #57606a;
}
.bulk-summary-meta-danger {
  color: #b91c1c;
}
.bulk-scenarios {
  margin-top: 16px;
}
.bulk-scenario-row-selected {
  background: #eff6ff;
}
.bulk-scenario-row-break-even {
  background: #fffbeb;
}
.bulk-scenario-note {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
}
/* Cart */
.sim-cart {
  margin-bottom: 16px;
}
.sim-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.clear-cart-btn {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #dc3545;
  border-radius: 6px;
  background: white;
  color: #dc3545;
  cursor: pointer;
}
.clear-cart-btn:hover {
  background: #dc3545;
  color: white;
}
.cart-empty {
  color: #888;
  font-size: 14px;
  padding: 24px;
  text-align: center;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px dashed #d0d7de;
}
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-item {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  background: white;
}
.cart-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cart-item-img {
  width: 48px;
  height: 67px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cart-item-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-item-psa10 {
  font-size: 13px;
  color: #555;
}
.cart-item-submeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #57606a;
}
.cart-item-market-link {
  color: #0969da;
  text-decoration: none;
}
.cart-item-market-link:hover {
  text-decoration: underline;
}
.cart-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.sim-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.ratio-good,
.badge-positive {
  background: #dcfce7;
  color: #166534;
}
.ratio-high,
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.ratio-low {
  background: #dbeafe;
  color: #1d4ed8;
}
.cart-remove-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: white;
  color: #dc3545;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.cart-remove-btn:hover {
  background: #dc3545;
  color: white;
}
.cart-item-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.cart-item-fields-secondary {
  margin-top: 8px;
}
.cart-item-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #555;
}
.cart-item-fields input,
.cart-item-fields select {
  width: 100%;
}
.cart-item-calc {
  display: flex;
  gap: 16px;
  font-size: 13px;
  padding-top: 8px;
  border-top: 1px solid #eaeef2;
}
.cart-item-calc-secondary {
  margin-top: 8px;
  color: #57606a;
}
.cart-item-logic-panel {
  margin-top: 12px;
  margin-bottom: 0;
}
.profit-positive {
  color: #16a34a;
}
.profit-caution {
  color: #b45309;
}
.profit-negative {
  color: #dc3545;
}
/* Summary */
.sim-summary {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 16px;
}
.sim-summary-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.summary-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: white;
  border: 1px solid #d0d7de;
  color: #57606a;
}
.chip-good {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}
.chip-warning {
  border-color: #fcd34d;
  background: #fef3c7;
  color: #92400e;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-label {
  font-size: 12px;
  color: #555;
}
.summary-value {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}
.summary-highlight {
  background: white;
  border-radius: 6px;
  padding: 8px;
  border: 1px solid #86efac;
}
/* ===== Mobile controls (hidden on desktop) ===== */
.controls-row {
  display: contents;
}
.filter-toggle-btn,
.mobile-sort,
.filter-panel {
  display: none;
}
/* Back to top button (mobile only, shown via .visible) */
.scroll-top-btn {
  display: none;
}
/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    padding: 8px;
    padding-top: 56px;
  }
  .navbar-inner {
    padding: 0 12px;
    gap: 12px;
  }
  .navbar-links {
    display: none;
  }
  .navbar-menu {
    display: block;
    order: 3;
    flex: 0 0 auto;
  }
  .cart-toggle-btn {
    order: 2;
    margin-left: auto;
  }
  .navbar-menu-btn {
    display: grid;
    place-content: center;
    gap: 4px;
    width: 36px;
    height: 34px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    list-style: none;
  }
  .navbar-menu-btn::-webkit-details-marker {
    display: none;
  }
  .navbar-menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: #24292f;
  }
  .navbar-menu-links {
    position: absolute;
    top: 48px;
    left: 8px;
    right: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
  }
  .navbar-menu[open] .navbar-menu-links {
    display: flex;
  }
  .member-nav {
    display: none;
  }
  .navbar-public .member-nav {
    display: flex;
  }
  .member-auth-btn {
    min-width: 58px;
    padding: 0 8px;
  }
  .navbar-link {
    font-size: 13px;
    padding: 6px 8px;
  }
  .container {
    padding: 12px;
    border-radius: 6px;
  }
  h1 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }
  .cards-page-title {
    margin-bottom: 10px;
    font-size: 18px;
  }
  .controls {
    gap: 8px;
    margin-bottom: 12px;
  }
  .member-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .member-auth-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 56px 8px 8px;
  }
  .member-fields {
    grid-template-columns: 1fr;
  }
  .member-actions {
    justify-content: flex-end;
  }
  .filter-input {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .clear-all-btn {
    flex: 1 1 100%;
  }
  .controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 100%;
  }
  .filter-toggle-btn {
    display: none;
  }
  .mobile-sort {
    display: flex;
    gap: 4px;
    flex: 1;
  }
  .favorite-filter-btn {
    flex: 1 1 100%;
  }
  .sort-select {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: white;
    color: #555;
  }
  .sort-dir-btn {
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #f6f8fa;
    color: #555;
    cursor: pointer;
    line-height: 1;
  }
  .filter-panel {
    margin-bottom: 12px;
    padding: 12px;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 8px;
  }
  .filter-panel {
    display: block;
  }
  .filter-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .filter-panel-item {
    min-width: 0;
  }
  .filter-panel-item .filter-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #656d76;
    margin-bottom: 4px;
  }
  .filter-panel-range {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .filter-panel-range input {
    flex: 1;
    min-width: 0;
    padding: 6px;
    font-size: 13px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    text-align: right;
  }
  .filter-panel-range input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
  }
  .filter-panel-range input.has-value {
    background-color: #ddf4ff;
    border-color: #54aeff;
  }
  .filter-panel-range span {
    color: #8c959f;
    font-size: 11px;
    flex-shrink: 0;
  }
  .filter-panel-range input::-webkit-outer-spin-button,
  .filter-panel-range input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .filter-panel-range input[type="number"] {
    -moz-appearance: textfield;
  }
  /* Hide thead range filters on mobile */
  thead .range-filter {
    display: none !important;
  }
  /* Table → Cards */
  .table-wrapper {
    max-height: none;
    overflow: visible;
  }
  table {
    min-width: 0;
  }
  thead {
    display: none;
  }
  th:first-child,
  td:first-child,
  th:nth-child(2),
  td:nth-child(2),
  #cardTable th:last-child,
  #cardTable td:last-child {
    position: static;
    left: auto;
    right: auto;
    min-width: 0;
    max-width: none;
    width: auto;
    box-shadow: none;
  }
  td:first-child,
  td:nth-child(2),
  #cardTable td:last-child {
    background: transparent;
  }
  tr:hover td:first-child,
  tr:hover td:nth-child(2),
  #cardTable tr:hover td:last-child {
    background: transparent;
  }
  tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: white;
  }
  tbody tr:hover {
    background: white;
  }
  td {
    padding: 0;
    border-bottom: none;
  }
  td:nth-child(2) {
    order: -2;
    flex: 0 0 58px;
    padding-right: 10px;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid #eaeef2;
  }
  .card-img {
    width: 48px;
    height: 67px;
  }
  .card-title {
    order: -1;
    flex: 1 1 calc(100% - 58px);
    min-width: 0;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid #eaeef2;
  }
  .card-title a {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
  }
  td:nth-child(n + 3) {
    flex: 0 0 50%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 4px;
    font-size: 13px;
  }
  td:nth-child(n + 3)::before {
    content: attr(data-label);
    font-size: 11px;
    color: #656d76;
    flex-shrink: 0;
    margin-right: 6px;
  }
  .action-cell {
    flex: 0 0 100%;
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid #eaeef2;
  }
  .action-cell::before {
    display: none !important;
  }
  .row-actions {
    width: 100%;
  }
  .cart-stepper {
    width: min(100%, 188px);
    grid-template-columns: 30px minmax(62px, 1fr) 30px;
    gap: 5px;
    padding: 5px;
    margin-left: auto;
    border-radius: 12px;
  }
  .favorite-btn {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
  .cart-stepper-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 14px;
  }
  .cart-stepper-status {
    padding: 4px 0 3px;
    border-radius: 10px;
  }
  .cart-stepper-status-count {
    font-size: 16px;
  }
  .cart-stepper-status-unit {
    font-size: 8px;
  }
  .datetime {
    color: #656d76;
  }
  /* Simulation responsive */
  .sim-settings-grid {
    grid-template-columns: 1fr;
  }
  .sim-mode-toggle {
    flex-direction: column;
  }
  .cart-item-fields,
  .cart-item-calc,
  .cart-item-calc-secondary,
  .sim-summary-header {
    flex-direction: column;
    gap: 8px;
  }
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
  /* Back to top button */
  .scroll-top-btn {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d0d7de;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 18px;
    color: #555;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 400px) {
  td:nth-child(n + 3) {
    flex: 0 0 100%;
  }
  .filter-panel-grid {
    grid-template-columns: 1fr;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
