:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  color: #24302a;
  background: #f4f7f4;
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid #bf6b16;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  border-radius: 7px;
  color: #fff;
  background: #183f2d;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 28px;
  background: #fff;
  border-bottom: 1px solid #dce4dd;
}

.brand {
  flex: 0 0 auto;
  font-size: 1.05rem;
  font-weight: 750;
  text-decoration: none;
}

.main-navigation {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 17px;
  min-width: 0;
}
.mobile-navigation { display: none; }
.main-navigation a {
  text-decoration: none;
  white-space: nowrap;
}
.main-navigation a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.main-navigation span {
  color: #687a70;
  white-space: nowrap;
}
.main-navigation .owner-nav {
  padding-left: 12px;
  border-left: 1px solid #dce4dd;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}
.header-actions form { margin: 0; }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 20px;
  padding: 0;
  color: #5d7467;
  font-size: .92rem;
  list-style: none;
}
.breadcrumbs li + li::before {
  margin-right: 7px;
  content: "/";
}

.page-heading { margin-bottom: 22px; }
.page-heading h1 { margin: 4px 0 8px; line-height: 1.25; }
.page-heading p:last-child { max-width: 68ch; margin-bottom: 0; }

.auth-card,
.empty-state,
.error-panel {
  width: min(560px, 100%);
  margin: 52px auto;
  padding: 28px;
  background: #fff;
  border: 1px solid #dce4dd;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgb(26 51 37 / 8%);
}
.page-heading + .empty-state { margin-top: 0; margin-left: 0; }
.auth-card h1,
.error-panel h1 { margin-top: 0; }

.form-field { margin: 18px 0; }
label {
  display: block;
  margin-bottom: 7px;
  font-weight: 650;
}
input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #84988c;
  border-radius: 8px;
  background: #fff;
}
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #84988c;
  border-radius: 8px;
  color: inherit;
  background: #fff;
}
select { min-height: 44px; }
textarea { resize: vertical; }
input[aria-invalid="true"] {
  border-color: #9d2e2e;
  box-shadow: 0 0 0 1px #9d2e2e;
}
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #9d2e2e;
  box-shadow: 0 0 0 1px #9d2e2e;
}

button,
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid #84988c;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}
.primary {
  color: #fff;
  border-color: #275c43;
  background: #275c43;
}
.primary:hover { background: #183f2d; }
.quiet { background: #f8faf8; }

.flash,
.error-summary,
.error-details,
.recovery-note {
  padding: 12px 14px;
  border-radius: 8px;
}
.flash { margin-bottom: 20px; }
.flash-success {
  color: #173d2b;
  border: 1px solid #8eb9a2;
  background: #e8f4ed;
}
.error-summary,
.error-details {
  color: #7c2020;
  border: 1px solid #d7a5a5;
  background: #fff2f2;
}
.field-errors {
  margin: 7px 0 0;
  padding-left: 20px;
  color: #8b2525;
  font-size: .92rem;
}
.field-errors + .form-field { margin-top: 14px; }

.status-code {
  margin: 0 0 4px;
  color: #5d7467;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.error-details { margin: 18px 0; }
.error-details h2 { margin: 0 0 8px; font-size: 1rem; }
.error-details ul { margin: 0; padding-left: 20px; }
.recovery-note { border: 1px solid #d7c19e; background: #fff8e9; }
.request-reference { margin: 24px 0 0; color: #5d7467; font-size: .85rem; }
.request-reference code { overflow-wrap: anywhere; }

.eyebrow {
  color: #5d7467;
  font-size: .83rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.page-heading-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.page-heading .button-row { margin-top: 18px; }
.table-shell {
  overflow: hidden;
  border: 1px solid #dce4dd;
  border-radius: 12px;
  background: #fff;
}
.responsive-table {
  width: 100%;
  border-collapse: collapse;
}
.responsive-table th,
.responsive-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e4eae6;
  text-align: left;
  vertical-align: top;
}
.responsive-table th {
  color: #52675b;
  background: #f7faf8;
  font-size: .88rem;
}
.responsive-table tbody tr:last-child td { border-bottom: 0; }
.responsive-table td a { font-weight: 650; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.detail-card,
.form-page {
  padding: 24px;
  border: 1px solid #dce4dd;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 32px rgb(26 51 37 / 6%);
}
.detail-card h2:first-child { margin-top: 0; }
.detail-list { margin: 0; }
.detail-list div {
  display: grid;
  grid-template-columns: minmax(110px, 34%) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1ee;
}
.detail-list dt { color: #5d7467; font-weight: 650; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.record-list,
.channel-list,
.card-history {
  margin: 0;
  padding: 0;
  list-style: none;
}
.record-list li,
.card-history li {
  display: grid;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid #edf1ee;
}
.record-list li:last-child,
.card-history li:last-child { border-bottom: 0; }
.channel-list li { margin: 7px 0; overflow-wrap: anywhere; }
.membership-list { margin: 0; padding: 0; list-style: none; }
.membership-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #e4eae6;
}
.membership-list li:last-child { border-bottom: 0; }
.membership-list form { flex: 0 0 auto; margin: 0; }
.status-badge,
.count-badge {
  display: inline-block;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  color: #315542;
  background: #e8f2ec;
  font-size: .78rem;
  font-weight: 700;
}
.status-red,
.status-pink { color: #7c2020; background: #fde8e8; }
.status-orange,
.status-amber,
.status-yellow { color: #6b4300; background: #fff1cc; }
.status-green,
.status-teal { color: #174d35; background: #dff3e8; }
.status-cyan,
.status-blue,
.status-indigo { color: #1e4778; background: #e2eefb; }
.status-violet { color: #563582; background: #efe6fb; }
.status-gray,
.status-slate { color: #46524b; background: #e9eeeb; }
.record-state {
  display: inline-block;
  margin-inline-start: 6px;
  color: var(--muted);
  font-size: .78rem;
}
.sales-status-card { grid-column: 1 / -1; }
.sales-records-card { grid-column: 1 / -1; }
.sales-record-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sales-record-list > li {
  padding: 16px 0;
  border-bottom: 1px solid #edf1ee;
}
.sales-record-list > li:last-child { border-bottom: 0; }
.sales-record-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
}
.sales-record-summary > strong { min-width: min(100%, 240px); }
.sales-record-summary > span:not(.status-badge) { color: #5d7467; }
.sales-record-list details { margin-top: 8px; }
.sales-record-list summary {
  width: fit-content;
  color: var(--brand);
  cursor: pointer;
  font-weight: 650;
}
.sales-record-list details form {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #dce4dd;
  border-radius: 10px;
  background: #f8faf9;
}
.current-sales-status {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}
.status-history {
  margin: 0;
  padding-left: 22px;
}
.status-history li {
  padding: 10px 0;
  border-bottom: 1px solid #edf1ee;
}
.status-history li:last-child { border-bottom: 0; }
.status-history span { display: block; margin-top: 3px; color: #5d7467; font-size: .9rem; }
.status-history p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-page { max-width: 880px; margin: 0 auto; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
}
.form-field-wide { grid-column: 1 / -1; }
.field-help { margin: 5px 0 0; color: #5d7467; font-size: .88rem; }
.checkbox-stack { display: grid; gap: 10px; margin-top: 18px; }
.checkbox-field {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-weight: 500;
}
.checkbox-field input { width: 18px; min-height: 18px; margin-top: 3px; }
.form-actions { margin-top: 24px; }
.duplicate-panel {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #d7c19e;
  border-radius: 10px;
  background: #fff8e9;
}
.duplicate-panel h2 { margin-top: 0; font-size: 1.05rem; }
.duplicate-panel li { margin: 8px 0; }
.confirm-duplicate { padding: 12px; border-radius: 8px; background: #fff8e9; }
.status-create-panel { max-width: none; margin-bottom: 24px; }
.status-settings-list { display: grid; gap: 16px; }
.status-settings-list > h2 { margin-bottom: 0; }
.status-setting-card { box-shadow: none; }
.status-setting-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.status-setting-header > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.confirm-deactivation {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff8e9;
}
.filter-panel {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid #dce4dd;
  border-radius: 12px;
  background: #f7faf8;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.filter-search { grid-column: span 2; }
.filter-panel .form-field { margin: 0; }
.filter-panel input,
.filter-panel select { min-height: 42px; }
.filter-actions { margin-top: 16px; }
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 22px 0 0;
}
.pagination span { color: #52675b; font-weight: 650; }

@media (max-width: 960px) {
  .site-header { flex-wrap: wrap; }
  .desktop-navigation { order: 3; flex-basis: 100%; overflow-x: auto; padding: 4px 0 8px; }
  .header-actions { margin-left: auto; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .site-header { align-items: center; gap: 12px; padding: 12px 16px; }
  .desktop-navigation { display: none; }
  .mobile-navigation {
    position: relative;
    display: block;
    order: 0;
    flex: 0 0 auto;
    margin-left: auto;
  }
  .mobile-navigation summary {
    display: block;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #84988c;
    border-radius: 8px;
    cursor: pointer;
    list-style-position: inside;
  }
  .mobile-navigation:not([open]) > .main-navigation { display: none; }
  .mobile-navigation[open] > .main-navigation {
    position: absolute;
    z-index: 10;
    top: calc(100% + 8px);
    right: 0;
    width: min(316px, calc(100vw - 32px));
    display: grid;
    gap: 0;
    overflow: visible;
    padding: 8px;
    border: 1px solid #c8d4cc;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgb(26 51 37 / 15%);
  }
  .main-navigation a,
  .main-navigation span {
    min-height: 42px;
    padding: 9px 10px;
  }
  .main-navigation .owner-nav {
    padding-left: 10px;
    border-top: 1px solid #e4eae6;
    border-left: 0;
  }
  .header-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid #e4eae6;
  }
  .user-name { max-width: 120px; }
  main { width: min(100% - 24px, 1120px); margin-top: 20px; }
  .auth-card,
  .empty-state,
  .error-panel { margin: 24px auto; padding: 22px 18px; }
  .page-heading-actions { align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-page { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field-wide { grid-column: auto; }
  .filter-panel { padding: 15px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .pagination { flex-wrap: wrap; }
  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid #dce4dd;
  }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(105px, 38%) 1fr;
    gap: 10px;
    padding: 5px 0;
    border: 0;
  }
  .responsive-table td::before {
    color: #5d7467;
    content: attr(data-label);
    font-size: .84rem;
    font-weight: 650;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
