:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #5d6877;
  --line: #dfe3e9;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #e8eff6;
  --live: #17784a;       --live-bg: #e4f4ec;
  --wait: #8a5a00;       --wait-bg: #fff2d0;
  --error: #b3261e;      --error-bg: #fce8e6;
  --grey: #4f5a68;       --grey-bg: #edeff2;
  --hold: #5b3f9a;       --hold-bg: #efe9fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 2px 8px rgba(20, 30, 45, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 56px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.logo, .login-logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='7' y='9' width='18' height='14' rx='2' fill='none' stroke='white' stroke-width='2'/%3E%3Ccircle cx='12' cy='14' r='2' fill='white'/%3E%3Cpath d='M8 22l6-5 4 3 3-2 4 4z' fill='white'/%3E%3C/svg%3E") center/100% no-repeat; }
.who { display: flex; gap: 14px; align-items: center; font-size: .95rem; }
.who-name { font-weight: 600; }
.link-quiet { color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; list-style: none;
}
.btn:hover { border-color: #b9c1cc; background: #fafbfc; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #8db4dc; outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #274f78; border-color: #274f78; }
.btn-lg { min-height: 48px; padding: 10px 22px; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .92rem; }
.btn-quiet { color: var(--error); }
.btn.is-busy { opacity: .6; pointer-events: none; }
summary.btn::-webkit-details-marker { display: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }

/* flash */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--live-bg); color: #0f5a37; border: 1px solid #b9e0cb; }
.flash-err { background: var(--error-bg); color: #8f1d17; border: 1px solid #f2c0bb; }

/* chips */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .84rem; font-weight: 600; line-height: 1.6; }
.chip-live { background: var(--live-bg); color: var(--live); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-error { background: var(--error-bg); color: var(--error); }
.chip-grey { background: var(--grey-bg); color: var(--grey); }
.chip-hold { background: var(--hold-bg); color: var(--hold); }
.chip-share { background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asin { color: #8a93a0; font-size: .8rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mkt { font-size: .72rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.pmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* list page */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.search input { width: 280px; max-width: 100%; min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.tab { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .94rem; }
.tab .count { color: var(--muted); font-weight: 600; margin-left: 4px; }
.tab.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab.is-on .count { color: #d6e4f2; }
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.pcard { display: flex; gap: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.pcard:hover { border-color: #b9c8d8; }
.pthumb { flex: none; width: 112px; height: 112px; border-radius: 9px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.pthumb img { width: 100%; height: 100%; object-fit: contain; }
.noimg { font-size: .78rem; color: var(--muted); text-align: center; padding: 6px; }
.pbody { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ptitle { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.empty { text-align: center; padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* product page */
.crumb { margin-bottom: 8px; font-size: .94rem; }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.phead-main { flex: 1 1 360px; min-width: 0; }
.phead-check { flex: 0 1 300px; }
.ext { font-size: .9rem; }
.checked { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.tick { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--live) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
form.inline { display: block; font-weight: 400; font-size: .9rem; }
.hint { font-size: .86rem; color: var(--muted); margin: 8px 0 0; }
.warnbox, .infobox { margin-top: 14px; padding: 12px 14px; border-radius: 10px; }
.warnbox { background: var(--wait-bg); border: 1px solid #ecd48e; color: #5f3f00; }
.infobox { background: var(--hold-bg); border: 1px solid #d6c9f2; color: #3f2a75; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 18px 0 26px; }
.pos { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 80px; }
.pos:target { border-color: var(--accent); box-shadow: 0 0 0 3px #bcd3ea; }
.pos-head { display: flex; justify-content: space-between; align-items: center; }
.pic { display: block; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
img.img-missing { background: var(--grey-bg); min-height: 100%; }
.reminder { font-size: .85rem; color: var(--wait); background: var(--wait-bg); padding: 6px 10px; border-radius: 8px; margin: 0; }
.dropzone { position: relative; aspect-ratio: 1 / 1; border: 2px dashed #b7c3d1; border-radius: 9px; background: #f8fafc; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; color: var(--muted); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone.busy { opacity: .5; }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-plus { font-size: 2.2rem; line-height: 1; font-weight: 300; }
.dz-title { font-weight: 700; color: var(--ink); }
.dz-sub { font-size: .85rem; }

.status { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.st { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; font-size: .9rem; }
.st-mkt { flex: none; min-width: 26px; font-weight: 700; font-size: .78rem; padding-top: 1px; }
.st-body { display: flex; flex-direction: column; min-width: 0; }
.st-label { font-weight: 650; }
.st-detail { font-size: .84rem; opacity: .9; overflow-wrap: anywhere; }
.st-live { background: var(--live-bg); color: var(--live); }
.st-wait { background: var(--wait-bg); color: var(--wait); }
.st-error { background: var(--error-bg); color: var(--error); }
.st-grey { background: var(--grey-bg); color: var(--grey); }
.st-hold { background: var(--hold-bg); color: var(--hold); }

.instead { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.instead-row { display: flex; gap: 10px; align-items: flex-start; }
.instead-row img { border: 1px solid var(--line); border-radius: 8px; background: #fff; object-fit: contain; flex: none; }
.instead-t { font-size: .86rem; color: var(--muted); margin-bottom: 6px; }

.shared summary { list-style: none; cursor: pointer; }
.shared summary::-webkit-details-marker { display: none; }
.shared ul { margin: 8px 0 0; padding-left: 18px; font-size: .88rem; }

.actions { margin-top: auto; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.replace[open] { flex: 1 1 100%; }
.replace form { margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.check em { color: var(--muted); font-style: normal; display: block; }
input[type=file] { max-width: 100%; font: inherit; font-size: .9rem; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { margin-bottom: 8px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.row-main { font-weight: 600; }
.row-sub { font-size: .85rem; color: var(--muted); }
.row-text { font-size: .9rem; overflow-wrap: anywhere; }
.tech summary { font-size: .84rem; color: var(--accent); cursor: pointer; }
.tech div { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 4px; }

/* login */
.login { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.login-logo { width: 44px; height: 44px; border-radius: 11px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .94rem; }
.field input, .field select { min-height: 46px; padding: 8px 12px; border: 1px solid #c4ccd6; border-radius: 9px; font: inherit; font-weight: 400; background: #fff; }

@media (max-width: 760px) {
  .two { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .plist { grid-template-columns: 1fr; }
  .pthumb { width: 96px; height: 96px; }
  .grid { grid-template-columns: 1fr; }
  .phead-check { flex: 1 1 100%; }
  .phead-check .btn { width: 100%; }
}

.instead-row .btn { white-space: normal; text-align: center; }

/* How it works page */
.prose { max-width: 720px; margin: 8px auto 48px; background: #fff; border: 1px solid #e3e6ea; border-radius: 12px; padding: 28px 32px; line-height: 1.6; }
.prose h1 { margin: 0 0 6px; font-size: 1.6rem; }
.prose .lead { font-size: 1.08rem; color: #3b4652; margin: 0 0 18px; }
.prose h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin: 6px 0; }
.prose ul.legend { list-style: none; padding-left: 0; }
.prose ul.legend .chip { margin-right: 8px; }
@media (max-width: 600px) { .prose { padding: 20px 16px; border-radius: 0; border-left: 0; border-right: 0; } }
