:root {
  --bg: #f7f6f3; --surface: #fff; --surface-2: #f1efe9; --line: #e4e1d8;
  --text: #1d1c19; --muted: #6d6a61; --accent: #9a6b12; --accent-soft: #f5ead3;
  --focus: #2c5bd6; --ok: #217a45; --ok-soft: #e3f3e8; --err: #b3261e; --warn-soft: #fdf0dc;
  --shadow: 0 1px 2px rgba(20,18,10,.06), 0 4px 16px rgba(20,18,10,.06);
  --radius: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161512; --surface: #1f1e1a; --surface-2: #282722; --line: #36342d;
    --text: #efece4; --muted: #a39f94; --accent: #e0b35a; --accent-soft: #3a2f19;
    --focus: #7ea2ff; --ok: #5cc98a; --ok-soft: #1c3325; --err: #ff8a80; --warn-soft: #3b2c14;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 8px; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.brand span { color: var(--accent); }
.brand small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.hl { background: var(--accent-soft); border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=tel], input[type=email], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.err { color: var(--err); font-size: 13px; min-height: 1.3em; }
.ok { color: var(--ok); font-size: 13px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.product { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; }
.product > div { min-width: 0; }
.product img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.product .name { font-weight: 700; font-size: 14px; line-height: 1.35; }
.product .price { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.linkbox { display: flex; gap: 6px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 5px 5px 5px 10px; font-size: 12px; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; text-decoration: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--warn-soft); color: var(--err); }
.strike { text-decoration: line-through; color: var(--muted); }
.notice { background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.center { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.center form { display: grid; gap: 10px; margin-top: 22px; text-align: left; }
.sns-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 6px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.product a.view { text-decoration: none; }
.product a.view:hover .name { text-decoration: underline; }
.product .name-edit { display: flex; gap: 6px; margin-top: 6px; }
.product .name-edit input { padding: 6px 10px; font-size: 13px; }
.linkname { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
@media (max-width: 560px) {
  .sns-row { grid-template-columns: 1fr auto; }
  .sns-row select { grid-column: 1 / -1; }
  .stat .value { font-size: 19px; }
}
