@import url("https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@300;400;500;700&family=Shippori+Mincho:wght@500;700&display=swap");

:root {
  --ink: #271f17;
  --paper: #fbf4ea;
  --accent: #e16f5c;
  --accent-dark: #c45544;
  --accent-soft: #ffe2d6;
  --teal: #2a7f7e;
  --line: #e3d4c1;
  --shadow: 0 16px 40px rgba(39, 31, 23, 0.12);
}

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

body {
  margin: 0;
  padding: 32px 20px 56px;
  font-family: "M PLUS 1p", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background-color: var(--paper);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 10%, #fff8f0 0%, transparent 55%),
    radial-gradient(circle at 80% 0%, #fbe8db 0%, transparent 50%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0 8px, rgba(251, 244, 234, 0.3) 8px 16px),
    var(--paper);
}

.site-header {
  max-width: 1280px;
  margin: 0 auto 32px;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-kicker {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 12px;
  color: #7c6c5b;
  margin: 0 0 6px;
}

.brand-kicker a {
  color: inherit;
  text-decoration: none;
}

.brand-kicker a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.admin-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #7c6c5b;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.admin-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f6eee4;
  color: #7c6c5b;
  font-weight: 600;
  font-size: 13px;
}

.admin-email {
  font-weight: 600;
  color: var(--ink);
}

.admin-logout {
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #7c6c5b;
  text-decoration: none;
  font-size: 12px;
}

.admin-logout:hover {
  color: var(--ink);
  background: #f6eee4;
}

.admin-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #7c6c5b;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.admin-email {
  font-weight: 600;
  color: var(--ink);
}

.brand-title {
  font-family: "Shippori Mincho", serif;
  font-size: 32px;
  margin: 0;
}

.brand-title a {
  color: inherit;
  text-decoration: none;
}

.brand-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.content {
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 64px;
}

.site-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(1280px, calc(100% - 32px));
  margin: 0;
  padding: 4px 0 6px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: #7c6c5b;
  z-index: 80;
}

.site-footer p {
  margin: 0;
  line-height: 1.2;
}

.card {
  background: #fff;
  padding: 20px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-family: "Shippori Mincho", serif;
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.form-row input {
  flex: 1;
  width: auto;
}

.form-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.hero {
  display: grid;
  grid-template-columns: minmax(360px, 640px) 1fr;
  gap: 36px;
  align-items: start;
}

.hero-media {
  position: relative;
  max-width: 640px;
}

.hero-image {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-tag {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.hero-copy h2 {
  font-family: "Shippori Mincho", serif;
  font-size: 32px;
  margin: 8px 0 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--teal);
  margin: 0;
}

.lead {
  line-height: 1.8;
  font-size: 16px;
  margin: 0 0 16px;
}

.price-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 14px 16px;
}

.price-label {
  font-size: 12px;
  margin: 0;
  color: #6b5846;
}

.price {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-dark);
}

.price-sub {
  margin: 6px 0 0;
  font-weight: 500;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.info-card {
  background: #fff;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.info-card h3 {
  margin: 0 0 8px;
  font-family: "Shippori Mincho", serif;
  font-size: 18px;
}

.summary {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.note {
  font-size: 12px;
  color: #7c6c5b;
  margin: 8px 0 0;
}

.trade-law-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}

.trade-law-table th,
.trade-law-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
}

.trade-law-table th {
  width: 220px;
  background: #f7fafc;
  text-align: left;
  font-weight: 600;
  color: #2a435b;
}

.trade-law-table td {
  color: #3a4a5b;
}

label {
  font-weight: 500;
}

.address-prefix {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

.address-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.address-line .address-prefix {
  min-width: 20em;
}

.address-prefix {
  color: var(--ink);
  background: #f6f1ea;
  border-color: #e4d9cc;
}

.address-prefix.muted {
  background: #f6f1ea;
  color: #b7a996;
  border-color: #e4d9cc;
  opacity: 0.75;
  cursor: not-allowed;
  user-select: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #b7a996;
}

.input-with-clear {
  position: relative;
}

.input-with-clear input {
  padding-right: 28px;
}

.input-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #b7a996;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.input-clear:hover {
  color: var(--accent-dark);
  background: transparent;
  transform: translateY(-50%);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f6f1ea;
  color: #b7a996;
  border-color: #e4d9cc;
  opacity: 0.75;
  cursor: not-allowed;
}

.input-compact {
  max-width: 160px;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:disabled {
  background: #d7c7b6;
  cursor: not-allowed;
  transform: none;
}

.button-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.button-link:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.notice {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  padding: 12px;
  border-radius: 12px;
}

.notice.error {
  background: #f8d7da;
  border-color: #f5c6cb;
}

.orders {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 14px;
}

.orders th,
.orders td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

.orders th {
  text-align: center;
}

.checkbox-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  cursor: default;
}

.checkbox-hit input {
  margin: 0;
  cursor: default;
}

.orders input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.orders th.orders-center,
.orders td.orders-center {
  text-align: center;
}

.orders th.orders-amount {
  text-align: center;
}

.orders td.orders-amount {
  text-align: right;
}

.sort-toggle {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f6eee4;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.sort-toggle:hover {
  background: #efe2d6;
}

.sort-toggle:focus-visible {
  outline: 2px solid #c8b3a1;
  outline-offset: 2px;
}

.orders tbody tr {
  cursor: pointer;
}

.orders th:first-child,
.orders td:first-child {
  text-align: center;
  vertical-align: middle;
  cursor: default;
}

.orders .checkbox-cell {
  position: relative;
  width: 48px;
  padding: 0;
}

.checkbox-cell .checkbox-hit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orders th.order-id-col,
.orders td.order-id-col {
  width: 140px;
  white-space: nowrap;
}

.orders tbody tr:hover {
  background: #faf4ed;
}

.orders-form {
  padding-bottom: 140px;
}

.sticky-actions {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  width: min(1280px, calc(100% - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  z-index: 90;
}

.sticky-fields {
  flex: 1;
}

.print-message-wrapper {
  position: relative;
}

.selected-summary {
  margin: 0 0 6px;
  font-size: 12px;
  color: #7c6c5b;
}

.sticky-fields textarea {
  min-height: 72px;
}

.history-toggle {
  position: absolute;
  right: 8px;
  top: -10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
}

.history-toggle:hover {
  background: #f6eee4;
}

.history-panel {
  position: absolute;
  right: 0;
  left: 0;
  bottom: calc(100% + 8px);
  width: auto;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 95;
}

.history-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.history-item:hover {
  background: #f6eee4;
}

.history-date {
  display: block;
  font-size: 11px;
  color: #8b7a68;
  margin-bottom: 2px;
}

.history-text {
  display: block;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-empty {
  font-size: 12px;
  color: #8b7a68;
  padding: 6px 8px;
}

.sticky-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.button-secondary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.button-secondary:hover {
  background: var(--accent-dark);
}

.button-danger {
  background: #d26a5c;
}

.button-danger:hover {
  background: #c45a4b;
}

.button-secondary:disabled,
.button-danger:disabled {
  background: #d7c7b6;
  color: #fff;
  cursor: not-allowed;
  transform: none;
}

.search-grid {
  display: grid;
  grid-template-columns: 60px minmax(140px, 1fr) 60px minmax(220px, 2fr) 70px minmax(160px, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 10px;
}

.search-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-self: center;
}

.detail {
  width: 100%;
  border-collapse: collapse;
}

.detail th,
.detail td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.detail th {
  width: 120px;
  white-space: nowrap;
  padding-right: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(21, 14, 8, 0.45);
  padding: 24px;
  z-index: 100;
}

.modal.is-open {
  display: flex;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
}

.processing-overlay[hidden] {
  display: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid #d8c8b8;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-content {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.modal-close {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.modal-close:hover {
  background: #f6eee4;
  transform: none;
}

.error-list {
  color: #b00020;
  padding-left: 18px;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.7s ease forwards;
}

.reveal:nth-of-type(2) {
  animation-delay: 0.08s;
}

.reveal:nth-of-type(3) {
  animation-delay: 0.16s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .sticky-buttons {
    justify-content: flex-start;
  }

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

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

  .price-box {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .site-header {
    padding: 12px 0 4px;
  }

  .content {
    padding-bottom: 72px;
  }

  .sticky-actions {
    bottom: 52px;
  }
}
