:root {
  --ink: #22221f;
  --paper: #f8f8f4;
  --red: #d9342c;
  --blue: #2455b8;
  --yellow: #e8bd31;
  --muted: #666660;
  --line: 1px solid var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: var(--line); background: white; min-height: 44px; padding: 10px 16px; font-weight: 600; border-radius: 0; }
button:hover { background: #f0f0e9; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, summary:focus-visible, [role="button"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
button.primary { background: var(--ink); color: white; }
button.primary:hover { background: #41413c; }
button.red { background: var(--red); color: white; }
button.quiet { border-color: transparent; background: transparent; padding: 8px 10px; font-weight: 500; }
button.quiet:hover { background: #eeeee7; }
button.icon { width: 44px; flex-shrink: 0; padding: 0; font-size: 25px; border-color: transparent; background: transparent; }
a { color: var(--blue); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.3; letter-spacing: -1px; font-weight: 750; }
h2 { font-size: 23px; line-height: 1.4; letter-spacing: -.5px; }
h3 { font-size: 18px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; }

.shell { max-width: 1180px; margin: auto; padding: 32px 36px 80px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 32px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { width: 42px; height: 42px; border: var(--line); flex-shrink: 0; }
.brand h1 { font-size: clamp(25px, 2.5vw, 32px); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.avatar { height: 34px; width: 34px; display: grid; place-items: center; background: white; border: var(--line); font-weight: 650; }
.top-actions .avatar { border-bottom: 3px solid var(--yellow); }

.stats { display: grid; grid-template-columns: 1.5fr 1fr 1fr; border: 2px solid var(--ink); background: white; margin-bottom: 32px; }
.stat { position: relative; min-width: 0; padding: 19px 22px 18px; display: flex; flex-direction: column; gap: 12px; border-right: 2px solid var(--ink); }
.stat:last-child { border-right: 0; }
.stat::before, .stat::after { position: absolute; pointer-events: none; }
.stat.red { padding-left: 72px; }
.stat.red::before { content: ""; top: 0; bottom: 36px; left: 0; width: 50px; background: var(--red); border-right: 2px solid var(--ink); }
.stat.red::after { content: ""; bottom: 0; left: 0; width: 50px; height: 36px; background: white; border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.stat.yellow { padding-top: 0; }
.stat.yellow .stat-label { margin: 0 -22px; padding: 10px 22px; min-height: 42px; color: var(--ink); background: var(--yellow); border-bottom: 2px solid var(--ink); }
.stat.blue { padding-right: 58px; }
.stat.blue::before { content: ""; top: 0; bottom: 0; right: 0; width: 36px; background: var(--blue); border-left: 2px solid var(--ink); }
.stat.blue::after { content: ""; top: 0; right: 0; width: 36px; height: 38px; background: white; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.stat-label { font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; color: var(--muted); }
.stat-value { font-size: clamp(25px, 3vw, 35px); letter-spacing: -1px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-foot { font-size: 12px; line-height: 1.5; color: var(--muted); }
.stat button { color: var(--ink); min-height: 44px; margin: -10px -8px -10px 0; padding: 8px; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }

.boardbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; }
.plan-switch { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.plan-switch button { white-space: nowrap; }
.space-select { max-width: 420px; min-width: 0; background: transparent; border: 0; font-weight: 650; font-size: 21px; padding: 8px 24px 8px 0; min-height: 44px; }
.toolbar { border-top: var(--line); border-bottom: var(--line); display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 22px; padding: 2px 0; }
.tabs { display: flex; gap: 8px; }
.tabs button { position: relative; border: 0; background: transparent; color: var(--muted); padding: 12px 14px; font-size: 14px; font-weight: 500; }
.tabs button.active { color: var(--ink); font-weight: 650; }
.tabs button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -3px; height: 3px; background: var(--ink); }
.toolbar select { min-width: 0; border: 0; background: transparent; max-width: 160px; min-height: 44px; padding: 10px 0; font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; }
.card { min-width: 0; border: var(--line); background: white; display: flex; position: relative; }
.priority-stripe { width: 4px; flex-shrink: 0; background: #bdbdb4; }
.card.must .priority-stripe { background: var(--red); }
.card.bought .priority-stripe { background: var(--blue); }
.card.dropped .priority-stripe { background: #d8d8cf; }
.card.dropped .card-title { color: var(--muted); }
.card-content { flex: 1; min-width: 0; padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.card-content:hover { background: #fdfdfb; }
.card-top { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.card-title { flex: 1; min-width: 0; }
.category { font-size: 11px; letter-spacing: .8px; color: var(--muted); margin-bottom: 5px; line-height: 1.5; }
.card-price { font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 650; letter-spacing: -.7px; line-height: 1.35; overflow-wrap: anywhere; }
.price-unknown { font-size: 16px; color: var(--muted); font-weight: 500; }
.card-note { font-size: 13px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; line-height: 1.6; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding-right: 50px; margin-top: 2px; border-top: 1px solid #e8e8e0; font-size: 12px; }
.tag { padding: 4px 7px; background: #f1f1eb; font-size: 11px; line-height: 1.4; white-space: nowrap; }
.tag.must { background: #fcecea; color: #a32c25; }
.tag.want { background: #faf4df; color: #71601d; }
.tag.maybe { background: #f1f1eb; color: #666660; }
.card-links { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; color: var(--muted); justify-content: flex-end; }
.card-image { display: block; width: calc(100% + 36px); height: 240px; margin: -18px -18px 3px; object-fit: contain; background: #f5f5ef; border: 0; border-bottom: 1px solid #e8e8e0; }
.reorder-card { position: absolute; right: 9px; bottom: 10px; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; font-size: 12px; color: var(--muted); }
.reorder-card:hover, .card.manual .reorder-card { color: var(--blue); background: #eef2fa; }
.card.manual { border-color: var(--blue); }
.thumb { height: 75px; width: 75px; object-fit: cover; border: var(--line); flex-shrink: 0; }
.move-buttons { display: flex; gap: 6px; }
.move-buttons button { min-height: 44px; width: 44px; padding: 0; font-size: 19px; }
.reorder-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.reorder-actions button { min-width: 0; }
.reorder-field { max-width: 100%; }
.reorder-field input { font-variant-numeric: tabular-nums; }

.small { font-size: 13px; color: var(--muted); line-height: 1.6; }
.empty { grid-column: 1 / -1; border: 1px solid #cecec4; padding: 42px 20px; text-align: center; display: grid; gap: 18px; justify-items: center; }
.empty-symbol { width: 44px; height: 44px; border: var(--line); display: grid; place-items: center; font-size: 28px; }
.board-foot { margin-top: 22px; display: flex; justify-content: space-between; gap: 20px; font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 6px; height: 6px; background: #bdbdb4; }
.legend i.must { background: var(--red); }
.legend i.maybe { background: #d8d8cf; }

.login { max-width: 880px; margin: 9vh auto 40px; display: grid; grid-template-columns: 1fr 1fr; border: var(--line); background: white; }
.login-art { background: #f1f1e9; padding: 48px 36px 34px; display: flex; flex-direction: column; justify-content: space-between; gap: 44px; min-height: 450px; border-right: var(--line); position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; top: 30px; left: 36px; width: 32px; height: 4px; background: var(--red); }
.login-art h1 { font-size: 46px; line-height: 1.4; letter-spacing: -2px; position: relative; z-index: 1; }
.login-art img { width: 100px; height: 100px; border: var(--line); align-self: flex-end; }
.login-form { padding: 42px 32px; display: flex; flex-direction: column; justify-content: center; gap: 20px; min-width: 0; }
.login-form h2 { font-size: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; line-height: 1.5; }
.field input, .field textarea, .field select { background: white; border: var(--line); border-radius: 0; width: 100%; padding: 12px; min-height: 47px; font-size: 16px; }
.field textarea { resize: vertical; min-height: 98px; line-height: 1.6; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox input { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--blue); flex-shrink: 0; }
.error { color: #a12c23; font-size: 13px; line-height: 1.6; min-height: 1px; overflow-wrap: anywhere; }

.overlay { position: fixed; inset: 0; background: rgba(22, 22, 18, .28); z-index: 10; display: flex; justify-content: flex-end; }
.drawer { width: 540px; max-width: 100%; height: 100%; background: var(--paper); border-left: var(--line); overflow: auto; overscroll-behavior: contain; padding: 24px 28px calc(36px + env(safe-area-inset-bottom)); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: var(--line); padding-bottom: 16px; margin-bottom: 24px; }
.drawer-header h2 { min-width: 0; overflow-wrap: anywhere; }
.drawer-header .category { margin: 0; }
.drawer :is(button, input, textarea, select) { scroll-margin: 20px; }
.form-stack { display: grid; gap: 19px; min-width: 0; }
.estimate-fields { min-width: 0; }
.estimate-fields summary { font-size: 13px; cursor: pointer; padding: 12px 0; font-weight: 600; }
.estimate-content { display: grid; gap: 16px; }
.calc-result { background: white; border: 1px solid #d5d5ca; border-left: 3px solid var(--yellow); padding: 14px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.calc-result strong { font-size: 21px; overflow-wrap: anywhere; min-width: 0; }
.detail-amount { font-size: 40px; font-weight: 700; letter-spacing: -1.5px; margin: 18px 0; overflow-wrap: anywhere; }
.amount-label { margin-top: 20px; }
.amount-label + .detail-amount { margin-top: 8px; }
.detail-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.detail-note { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; margin: 22px 0; }
.section { border-top: var(--line); margin-top: 24px; padding-top: 20px; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 15px; font-weight: 650; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .primary { flex: 1; }
.images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.image-cell { position: relative; min-width: 0; }
.image-cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid #d5d5ca; }
.image-cell button { position: absolute; right: 0; top: 0; width: 44px; min-height: 44px; padding: 2px 8px; font-size: 22px; background: white; }
.images.single { grid-template-columns: minmax(0, 1fr); }
.images.single .image-cell img { aspect-ratio: auto; max-height: 520px; object-fit: contain; background: white; }
.link-card { border: var(--line); display: block; padding: 16px; text-decoration: none; color: inherit; overflow-wrap: anywhere; margin: 16px 0; background: white; }
.link-card strong { display: block; font-size: 15px; line-height: 1.5; }
.link-card p { margin: 7px 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.link-card small { color: var(--blue); font-size: 12px; }
.comment { padding: 15px 0; border-bottom: 1px solid #dcdcd2; }
.comment-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.comment-top strong { color: var(--ink); }
.comment-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 12px; margin-top: 17px; }
.comment-form textarea { min-height: 82px; }
.comment-form button { align-self: flex-end; }
.panel-note { border-left: 3px solid var(--blue); padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.invite-url { font-size: 13px; overflow-wrap: anywhere; padding: 14px; background: white; border: var(--line); border-left: 3px solid var(--yellow); margin-top: 18px; }
.save-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account-list { display: grid; gap: 15px; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; overflow-wrap: anywhere; }
.member .avatar { width: 32px; height: 32px; flex-shrink: 0; }

#toast { position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 13px 20px; background: var(--ink); color: white; font-size: 14px; z-index: 30; max-width: 90%; opacity: 0; pointer-events: none; transition: opacity .15s; overflow-wrap: anywhere; }
#toast.show { opacity: 1; }
.loading { padding: 70px 25px; text-align: center; font-size: 17px; }
.hide { display: none !important; }
.danger { color: #a12c23; }

@media (min-width: 761px) {
  .card.photo .card-content { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px 16px; }
  .card.photo .card-image { grid-column: 2; grid-row: 1 / 3; width: 130px; height: 160px; margin: 0; border: 1px solid #e8e8e0; }
  .card.photo .card-top { grid-column: 1; grid-row: 1; align-self: start; }
  .card.photo .card-price { grid-column: 1; grid-row: 2; align-self: end; }
  .card.photo .card-note, .card.photo .card-meta { grid-column: 1 / -1; }
}

@media (min-width: 1600px) {
  .shell { padding-top: 44px; }
}

@media (max-width: 760px) {
  .shell { padding: 21px 18px 70px; }
  .topbar { gap: 10px; margin-bottom: 24px; }
  .brand { gap: 10px; }
  .brand img { width: 34px; height: 34px; }
  .brand h1 { font-size: 24px; }
  .top-actions { gap: 0; }
  .top-actions .user-name { display: none; }
  .top-actions button.quiet { padding: 5px; }
  .avatar { height: 30px; width: 30px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 24px; }
  .stat { padding: 14px 14px 13px; gap: 9px; }
  .stat:first-child { grid-column: 1 / -1; border-right: 0; border-bottom: 2px solid var(--ink); }
  .stat.red { padding-left: 52px; }
  .stat.red::before { width: 36px; bottom: 26px; }
  .stat.red::after { width: 36px; height: 26px; }
  .stat.yellow { padding-top: 0; }
  .stat.yellow .stat-label { margin: 0 -14px; padding: 9px 14px; min-height: 38px; }
  .stat.blue { padding-right: 38px; }
  .stat.blue::before { width: 24px; }
  .stat.blue::after { width: 24px; height: 30px; }
  .stat-value { font-size: 27px; }
  .stat.blue .stat-value { font-size: 25px; }
  .stat:first-child .stat-value { font-size: 31px; }
  .stat-label { font-size: 12px; min-height: 20px; gap: 6px; }
  .stat-foot { font-size: 11px; }
  .boardbar { flex-wrap: wrap; gap: 10px; padding-bottom: 16px; }
  .plan-switch { flex-basis: 100%; width: 100%; gap: 6px; }
  .space-select { flex: 1; font-size: 18px; max-width: 100%; padding-right: 8px; }
  .plan-switch button { padding: 8px; font-size: 13px; }
  .boardbar > .actions { margin-left: auto; }
  .boardbar .actions button { font-size: 13px; padding: 9px 13px; }
  .toolbar { gap: 8px; margin-bottom: 18px; }
  .tabs { gap: 0; }
  .tabs button { font-size: 14px; padding: 12px 9px; }
  .tabs button.active::after { left: 9px; right: 9px; }
  .toolbar select { max-width: 108px; font-size: 12px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card-content { padding: 17px 16px 9px; gap: 11px; }
  .card-image { width: calc(100% + 32px); height: 180px; margin: -17px -16px 3px; }
  .card-price { font-size: 24px; }
  .price-unknown { font-size: 16px; }
  .card-meta { font-size: 11px; }
  .board-foot { align-items: flex-start; }
  .legend { gap: 8px 14px; }
  .login { margin: 22px 18px; grid-template-columns: minmax(0, 1fr); }
  .login-art { min-height: 155px; padding: 35px 25px 24px; border-right: 0; border-bottom: var(--line); flex-direction: row; align-items: flex-end; gap: 16px; }
  .login-art::before { top: 21px; left: 25px; width: 24px; height: 3px; }
  .login-art h1 { font-size: 30px; letter-spacing: -1px; line-height: 1.4; }
  .login-art img { width: 58px; height: 58px; flex-shrink: 0; }
  .login-form { padding: 29px 25px; gap: 18px; }
  .drawer { width: 100%; border-left: 0; padding: 19px 20px calc(32px + env(safe-area-inset-bottom)); }
  .drawer-header { padding-bottom: 14px; margin-bottom: 20px; }
  .detail-amount { font-size: 35px; }
  .field-row { gap: 12px; }
  .calc-result strong { font-size: 19px; }
  .images.single .image-cell img { max-height: 440px; }
  .board-foot > span { max-width: 42%; text-align: right; }
}

@media (max-width: 350px) {
  .shell { padding-right: 16px; padding-left: 16px; }
  .brand h1 { font-size: 22px; }
  .tabs button { padding: 12px 7px; }
  .tabs button.active::after { left: 7px; right: 7px; }
  .toolbar select { max-width: 100px; }
  .card-price { font-size: 22px; }
  .price-unknown { font-size: 16px; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding-right: 20px; padding-left: 20px; }
  .login-art::before { left: 20px; }
  .login-art h1 { font-size: 27px; }
  .login-art img { width: 48px; height: 48px; }
  .login-form { padding-right: 20px; padding-left: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
