:root {
  --ink: #172321;
  --muted: #68716d;
  --line: #d8ddd9;
  --paper: #f5f6f3;
  --surface: #fff;
  --teal: #0d5b56;
  --teal-dark: #073c3a;
  --coral: #c65d46;
  --success: #276141;
  --radius: 6px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.account-header { min-height: 68px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #fff; background: var(--teal-dark); border-bottom: 3px solid var(--coral); }
.account-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-family: Georgia, "Songti SC", serif; }
.account-brand::first-letter { border: 1px solid #8cb0ac; }
.account-brand span { font-size: 16px; }
.account-nav { display: flex; align-items: center; gap: 18px; color: #c8dcda; font-size: 13px; }
.account-nav a { color: #fff; text-decoration: none; }
.account-nav a:hover { text-decoration: underline; }
.account-nav form { margin: 0; }
.account-nav form input { display: none; }
.account-nav button { padding: 4px 7px; border: 1px solid #799c98; border-radius: 3px; color: #fff; background: transparent; cursor: pointer; }
.account-nav button:hover { border-color: #fff; }
.account-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 60px; }
.account-eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; }
h1, h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-weight: 500; }
h1 { margin-top: 7px; font-size: 30px; }
h2 { font-size: 20px; }
p { color: var(--muted); line-height: 1.8; }

.login-layout { min-height: calc(100vh - 170px); display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: center; gap: 90px; }
.login-copy { max-width: 560px; }
.login-copy h1 { margin-top: 12px; font-size: 48px; }
.login-copy p { max-width: 470px; font-size: 16px; }
.login-form, .narrow-panel { padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 45px rgba(15,39,34,.08); }
.form-heading { margin-bottom: 24px; }
.form-heading span { color: var(--muted); font-size: 11px; font-weight: 700; }
.form-heading h2 { margin-top: 5px; font-size: 26px; }
.login-form, .stack-form { display: grid; gap: 18px; }
label { display: grid; gap: 6px; }
label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
label small { color: var(--muted); font-size: 11px; }
input, select, textarea { width: 100%; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
input, select { height: 44px; }
textarea { min-height: 82px; padding-top: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,91,86,.1); }
.primary-button, .secondary-button { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); cursor: pointer; text-decoration: none; }
.primary-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); }
.form-message, .notice { padding: 11px 13px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.form-message.error { color: #8f352a; background: #f6e4e0; border: 1px solid #e8c3ba; }
.form-message.success { color: var(--success); background: #e0efe5; border: 1px solid #bad8c5; }
.notice { margin: 20px 0; color: #80581b; background: #f6ecd8; border: 1px solid #e4d0a5; }
.narrow-panel { width: min(520px, 100%); margin: 50px auto 0; }
.narrow-panel .stack-form { margin-top: 25px; }

.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.admin-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.create-account-section { margin-top: 25px; padding: 25px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.create-account-form { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr minmax(220px, 1.3fr) 1fr auto; gap: 12px; align-items: end; }
.account-table-section { margin-top: 32px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-title span { color: var(--muted); font-size: 13px; }
.account-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.account-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.account-table th { height: 42px; padding: 0 12px; color: var(--muted); background: #edf0ec; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; }
.account-table td { min-height: 58px; padding: 11px 12px; border-bottom: 1px solid #e7e9e6; font-size: 13px; vertical-align: top; }
.account-table tr:last-child td { border-bottom: 0; }
.account-table td strong, .account-table td small { display: block; }
.account-table td small { margin-top: 4px; color: var(--muted); }
.account-table td a { color: var(--teal); }
.state { display: inline-block; padding: 4px 7px; border-radius: 3px; font-size: 11px; }
.state.on { color: var(--success); background: #e0efe5; }
.state.off { color: #8f352a; background: #f6e4e0; }
.account-actions { min-width: 200px; }
.account-actions form { display: inline; }
.text-button { padding: 0; border: 0; color: var(--teal); background: none; cursor: pointer; font-size: 12px; }
.text-button:disabled { color: #a2aaa6; cursor: default; }
details { display: inline-block; margin-left: 12px; }
summary { color: var(--teal); cursor: pointer; font-size: 12px; }
.inline-reset { margin-top: 9px; display: flex !important; gap: 7px; align-items: center; }
.inline-reset input { width: 155px; height: 34px; font-size: 12px; }

.customer-detail-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 24px; }
.customer-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.customer-profile-meta { margin-top: 10px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.profile-state { padding: 4px 7px; border-radius: 3px; }
.profile-state.complete { color: var(--success); background: #e0efe5; }
.profile-state.pending { color: #80581b; background: #f6ecd8; }
.customer-stat-band { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.customer-stat-band > div { min-height: 82px; padding: 14px 18px; display: grid; align-content: center; gap: 5px; border-right: 1px solid var(--line); }
.customer-stat-band > div:last-child { border-right: 0; }
.customer-stat-band span { color: var(--muted); font-size: 11px; }
.customer-stat-band strong { font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.customer-info-section, .customer-history-section { margin-top: 32px; }
.customer-info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.customer-info-grid > div { min-height: 88px; padding: 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.customer-info-grid > div:nth-child(4n) { border-right: 0; }
.customer-info-grid > div:nth-last-child(-n+4) { border-bottom: 0; }
.customer-info-grid > div.wide { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
.customer-info-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.customer-info-grid strong { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.customer-info-grid .empty-value { display: inline; color: #929a96; font-weight: 400; }
.ring-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.ring-size { min-width: 32px; height: 28px; margin: 0 !important; display: inline-grid !important; place-items: center; padding: 0 7px; color: var(--teal-dark) !important; background: #dfebe7; border-radius: 3px; font-size: 12px !important; }
.customer-history-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.customer-history-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.customer-history-table th { height: 40px; padding: 0 8px; color: var(--muted); background: #edf0ec; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; }
.customer-history-table td { height: 62px; padding: 7px 8px; border-bottom: 1px solid #e7e9e6; font-size: 13px; vertical-align: middle; }
.customer-history-table th:nth-child(5) { width: 230px; }
.customer-history-table tr:last-child td { border-bottom: 0; }
.customer-history-table td:first-child { width: 100px; }
.customer-history-table td strong, .customer-history-table td small { display: block; }
.customer-history-table td small { margin-top: 4px; color: var(--muted); }
.customer-order-row { cursor: pointer; }
.customer-order-row:hover { background: #f5f8f6; }
.customer-order-row:focus { outline: 2px solid var(--teal); outline-offset: -2px; }
.customer-order-link { color: var(--teal); text-decoration: none; }
.customer-order-link:hover { text-decoration: underline; }
.customer-order-thumb, .customer-order-no-image { width: 48px; height: 48px; border-radius: 4px; }
.customer-order-thumb { display: block; object-fit: cover; border: 1px solid var(--line); }
.customer-order-no-image { display: grid; place-items: center; color: var(--muted); background: #edf0ec; font-size: 10px; }
.order-status { display: inline-block; padding: 4px 7px; color: #28587b; background: #e1edf5; border-radius: 3px; font-size: 11px; }
.empty-value { color: #929a96; }

.change-history-section { padding-top: 6px; border-top: 1px solid var(--line); }
.change-timeline { margin: 0; padding: 0; display: grid; gap: 12px; list-style: none; }
.change-entry { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.change-entry-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #e7e9e6; }
.change-entry-header > div { display: grid; gap: 4px; }
.change-entry-header > div > strong { font-size: 15px; }
.change-entry-header > div > span, .change-entry-header small { color: var(--muted); font-size: 11px; }
.change-entry-header small { padding-top: 2px; text-align: right; }
.change-fields { padding-top: 15px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.change-field { min-width: 0; display: grid; gap: 6px; }
.change-field > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.change-field > div { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.change-field > div b { color: var(--muted); font-weight: 400; }
.change-field strong, .change-before { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.change-before { color: #7a837f; text-decoration: line-through; }
.change-empty { color: #929a96; font-weight: 400; text-decoration: none; }

.data-import-section { padding: 22px 0; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.data-import-section > div { display: grid; gap: 5px; }
.data-import-section > div span { color: var(--muted); font-size: 11px; }
.import-form { display: flex; align-items: center; gap: 10px; }
.import-form input[type="file"] { width: min(360px, 48vw); padding: 8px; }
.manual-entry-section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.customer-data-form { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
.customer-data-form label.wide { grid-column: span 2; }
.customer-data-form .primary-button { justify-self: start; }
.customer-data-form.edit { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.customer-data-form input[readonly] { color: #65706b; background: #edf0ec; cursor: not-allowed; }
.customer-data-list { margin-top: 30px; }
.customer-data-list .section-title { gap: 20px; }
.data-search { width: min(480px, 55vw); display: flex; gap: 8px; }
.data-search input { min-width: 0; }
.data-search .secondary-button { flex: 0 0 auto; }
.customer-data-table { min-width: 1500px; }
.customer-data-table .address-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-data-table td a { text-decoration: none; }
.customer-data-table td a:hover { text-decoration: underline; }
.customer-data-actions { display: flex; gap: 12px; white-space: nowrap; }
.customer-data-actions form, .order-admin-actions form, .archive-table form { margin: 0; }
.order-admin-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.archive-button { color: #943e31; }
.restore-button { color: var(--success); }
.archive-disabled { color: #929a96; font-size: 11px; cursor: not-allowed; }
.data-list-count { padding-top: 10px; color: var(--muted); font-size: 12px; text-align: right; }
.edit-customer-section { margin-top: 24px; }
.order-data-form { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
.order-data-form .wide { grid-column: span 2; }
.order-data-form .primary-button { justify-self: start; }
.order-data-form.edit { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.order-image-field { display: grid; gap: 8px; }
.order-image-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.order-image-field input[type="file"] { height: auto; min-height: 44px; padding: 8px; }
.order-form-images { display: grid; grid-template-columns: repeat(6, 58px); gap: 7px; }
.order-form-images a { width: 58px; height: 58px; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #edf0ec; }
.order-form-images img { width: 100%; height: 100%; display: block; object-fit: cover; }
.order-image-keep { min-height: 28px; display: flex; align-items: center; gap: 8px; }
.order-image-keep input { width: 17px; height: 17px; margin: 0; }
.order-image-keep span { color: var(--ink); font-size: 12px; font-weight: 500; }
.order-data-table { min-width: 2100px; }
.order-admin-image { display: flex; align-items: center; gap: 8px; }
.order-admin-image img, .order-admin-no-image { width: 46px; height: 46px; border-radius: 4px; }
.order-admin-image img { display: block; object-fit: cover; border: 1px solid var(--line); }
.order-admin-image small { color: var(--muted); white-space: nowrap; }
.order-admin-no-image { display: grid; place-items: center; color: var(--muted); background: #edf0ec; font-size: 10px; }
.operation-history-section { margin-top: 12px; }
.operation-table { min-width: 1050px; }
.operation-table th:nth-child(1) { width: 170px; }
.operation-table th:nth-child(2) { width: 130px; }
.operation-table th:nth-child(3) { width: 120px; }
.operation-table th:nth-child(4) { width: 190px; }
.operation-type { display: inline-block; padding: 4px 7px; color: #28587b; background: #e1edf5; border-radius: 3px; font-size: 11px; }
.operation-result { color: #4f5a56; line-height: 1.55; }
.operation-empty { padding: 36px !important; color: var(--muted); text-align: center; }
.archive-notice { margin-top: 0; }
.archive-section { margin-top: 30px; }
.archive-table { min-width: 780px; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; gap: 30px; align-content: center; }
  .login-copy { display: none; }
  .login-form { width: min(430px, 100%); margin: 0 auto; }
  .create-account-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-account-form .primary-button { align-self: end; }
  .customer-stat-band { grid-template-columns: repeat(3, 1fr); }
  .customer-stat-band > div:nth-child(3) { border-right: 0; }
  .customer-stat-band > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .customer-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-info-grid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .customer-info-grid > div:nth-child(2) { border-right: 0; }
  .customer-info-grid > div:nth-child(2n) { border-right: 0; }
  .customer-info-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
  .data-import-section { align-items: stretch; flex-direction: column; }
  .import-form { align-items: stretch; }
  .import-form input[type="file"] { width: 100%; }
  .customer-data-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-data-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .account-header { min-height: 68px; padding: 10px 15px; flex-wrap: wrap; }
  .account-brand span { display: none; }
  .account-nav { width: 100%; gap: 12px; overflow-x: auto; white-space: nowrap; font-size: 12px; }
  .account-nav > span { display: none; }
  .account-main { width: calc(100% - 28px); padding-top: 24px; }
  .login-form, .narrow-panel { padding: 22px 18px; }
  .create-account-form { grid-template-columns: 1fr; }
  .admin-heading { align-items: start; flex-direction: column; }
  .admin-heading-actions { width: 100%; }
  .admin-heading-actions .secondary-button { flex: 1; }
  .customer-detail-heading { align-items: start; flex-direction: column; }
  .customer-stat-band { grid-template-columns: repeat(2, 1fr); }
  .customer-stat-band > div { border-bottom: 1px solid var(--line); }
  .customer-stat-band > div:nth-child(2n) { border-right: 0; }
  .customer-stat-band > div:last-child { border-bottom: 0; }
  .customer-info-grid { grid-template-columns: 1fr; }
  .customer-info-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .customer-info-grid > div:last-child { border-bottom: 0; }
  .customer-heading-actions { width: 100%; }
  .customer-heading-actions .secondary-button { flex: 1; }
  .change-entry { padding: 16px; }
  .change-entry-header { align-items: start; flex-direction: column; gap: 7px; }
  .change-entry-header small { text-align: left; }
  .change-fields { grid-template-columns: 1fr; }
  .import-form { flex-direction: column; }
  .customer-data-form { grid-template-columns: 1fr; }
  .customer-data-form label.wide { grid-column: 1; }
  .order-data-form { grid-template-columns: 1fr; }
  .order-data-form .wide { grid-column: 1; }
  .order-form-images { grid-template-columns: repeat(4, 58px); }
  .data-search { width: 100%; }
  .customer-data-list .section-title { align-items: stretch; flex-direction: column; }
  h1 { font-size: 26px; }
}
