:root { color-scheme: light; --ink: #29231e; --muted: #8c857c; --line: #eee9e2; --accent: #ed9209; --brown: #805836; --paper: #fff; --soft: #faf7f2; --orange: #f26419; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f6f5f2; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.6; font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 3px solid #d99027; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.3; letter-spacing: .02em; }
h2 { font-size: 19px; }
h3 { font-size: 17px; margin-bottom: 16px; }
.portal-shell { min-height: 100dvh; }
.portal-header { height: 82px; padding: 0 max(24px, calc((100vw - 1080px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fffcf7; border-bottom: 1px solid var(--line); }
.portal-brand { display: flex; align-items: center; gap: 10px; color: var(--brown); font-size: 19px; font-weight: 700; white-space: nowrap; }
.portal-brand > svg { width: 34px; height: 34px; }
.portal-brand small { display: block; font-weight: 400; font-size: 11px; letter-spacing: .13em; color: var(--muted); }
.portal-brand img { object-fit: contain; }
.portal-identity { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.portal-identity > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.portal-identity img, .publisher img { border-radius: 50%; object-fit: cover; }
.portal-identity form { margin-left: 8px; }
.portal-main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 130px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 24px; }
.eyebrow { display: block; color: #a57b44; font-size: 12px; letter-spacing: .09em; margin-bottom: 7px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: #6b5541; background: #fff; border: 1px solid #e4dcd1; border-radius: 24px; min-height: 42px; padding: 8px 22px; white-space: nowrap; font-weight: 500; line-height: 1.5; }
.button:hover { background: #fff9f0; }
.button.primary { background: linear-gradient(115deg, #ffb62e, #f1990b); border-color: #f3a317; color: #fff; box-shadow: 0 4px 12px #e3a54520; }
.text-button { border: 0; padding: 4px 0; background: none; color: #8d7763; }
.danger { color: #b95642; }
.wide { width: 100%; }
.surface { background: #fff; padding: 28px; margin-bottom: 22px; border: 1px solid #f0ebe4; border-radius: 18px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.section-title > span { color: var(--muted); font-size: 12px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; margin-top: 8px; }
label { display: flex; flex-direction: column; gap: 8px; color: #605448; font-size: 14px; }
input:not([type="hidden"]):not([type="file"]), select, textarea { width: 100%; padding: 11px 13px; color: var(--ink); background: #fff; border: 1px solid #e6dfd5; border-radius: 8px; outline-offset: 2px; min-width: 0; }
input::placeholder, textarea::placeholder { color: #b3aaa0; }
textarea { resize: vertical; min-height: 74px; line-height: 1.65; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-switch button { display: flex; align-items: center; gap: 13px; border: 1px solid #e7e1d8; border-radius: 12px; padding: 18px 22px; background: #fff; color: #7d7267; text-align: left; font-weight: 600; font-size: 17px; }
.mode-switch button svg { width: 28px; height: 28px; }
.mode-switch button small { display: block; color: #a1978b; font-size: 12px; font-weight: 400; margin-top: 3px; }
.mode-switch [aria-pressed="true"] { background: #fff9ed; color: #b87517; border-color: #efb75a; box-shadow: inset 0 0 0 1px #f2cd8d; }
#collect-panel { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
#collect-panel:not([hidden]) { display: grid; gap: 10px; }
#collect-panel #source-url, #collected-price input { min-height: 46px; }
#collect-panel .notice { margin: 0; }
.role-detail-heading { align-items: center; }
.role-detail-heading .button { padding-inline: 18px; }
#partner-generate-all:disabled { opacity: .55; cursor: default; }
.generated-card-link { display: block; color: #8d5c22; }
.generated-card-image { display: block; width: 100%; height: auto; border-radius: 8px; }
.publish-client { position: relative; display: grid; gap: 8px; min-width: 0; }
.publish-client-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid #e6dfd5;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    text-align: left;
}
.publish-client-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publish-client-trigger::after {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-right: 1px solid;
    border-bottom: 1px solid;
    transform: translateY(-2px) rotate(45deg);
}
.publish-client-trigger[aria-expanded="true"]::after { transform: translateY(2px) rotate(225deg); }
.publish-client-options {
    position: absolute;
    z-index: 5;
    top: calc(100% + 2px);
    inset-inline: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e6dfd5;
    border-radius: 8px;
    padding: 4px;
    background: #fff;
    box-shadow: 0 8px 24px #3c2e211f;
}
.publish-client-options button {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    overflow-wrap: anywhere;
}
.publish-client-options button:hover, .publish-client-options button[aria-pressed="true"] {
    background: #fff4e3;
    color: #9a5c14;
}
.notice { padding: 12px 16px; margin: 14px 0; background: #fff6df; border-radius: 9px; color: #8b6329; font-size: 13px; overflow-wrap: anywhere; }
.notice.error { color: #b54b3a; background: #fff0eb; }
.product-fields { display: grid; grid-template-columns: 180px 1fr; gap: 28px; margin-bottom: 22px; }
.cover-upload { position: relative; }
.cover-upload input { position: absolute; inset: 28px 0 0; width: 100%; height: 160px; opacity: 0; cursor: pointer; z-index: 1; }
.cover-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 1px dashed #decbb1; background: var(--soft); border-radius: 12px; overflow: hidden; width: 108px; max-width: 100%; height: 96px; color: #b39671; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview svg { width: 34px; height: 34px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-grid .full { grid-column: 1 / -1; }
.role-tabs, .status-tabs { display: flex; gap: 24px; overflow-x: auto; border-bottom: 1px solid var(--line); white-space: nowrap; scrollbar-width: thin; }
.role-tabs { margin: 22px 0; }
.role-tabs button, .status-tabs a { color: #92877b; border: 0; border-bottom: 3px solid transparent; padding: 12px 0 13px; background: none; font-size: 16px; }
.role-tabs button[aria-selected="true"], .status-tabs a[aria-current="page"] { color: #db8c12; border-bottom-color: #f3a51c; font-weight: 600; }
.empty-label { color: #b0a597; padding: 25px 0; text-align: center; font-size: 13px; }
.submit-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 24px 0; }
.submit-bar p { font-size: 12px; color: var(--muted); }
.submit-bar > div { display: flex; gap: 12px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 110px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); background: #fffefbed; border-top: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 20; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 24px; color: #a99b8a; font-size: 12px; }
.bottom-nav a[aria-current="page"] { color: #976334; }
.bottom-nav svg { width: 24px; height: 24px; }
.login-wrap { min-height: calc(100dvh - 250px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); padding: 36px; border-radius: 22px; box-shadow: 0 20px 70px #9279530b; }
.login-card h1 { font-size: 29px; margin-bottom: 8px; }
.login-card form { margin-top: 28px; }
.login-card label { margin-bottom: 20px; }
.login-help { font-size: 12px; text-align: center; margin-top: 24px; }
.mine-surface { padding: 0 28px; }
.status-tabs { gap: 30px; margin-bottom: 4px; }
.status-tabs a { padding-top: 18px; font-size: 16px; }
.status-tabs span { margin-left: 4px; font-size: 12px; }
.my-product { display: grid; grid-template-columns: 180px 1fr; gap: 0 22px; padding: 25px 0 0; border-bottom: 1px solid var(--line); }
.my-product:last-child { border-bottom: 0; }
.my-product-cover { height: 180px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.my-product-cover img { width: 100%; height: 100%; object-fit: cover; }
.my-product-info { min-width: 0; }
.my-product-info h2 { font-size: 19px; line-height: 1.5; margin: 5px 0; overflow-wrap: anywhere; }
.my-product-info .muted { font-size: 13px; }
.status-pill { display: inline-block; color: #92785c; background: #f2ede6; font-size: 10px; padding: 1px 7px; border-radius: 4px; }
.status-pill.published { background: #e9f3e9; color: #4c8859; }
.product-price { font-size: 27px; font-weight: 650; color: var(--orange); margin: 6px 0; line-height: 1.4; }
.product-price small { font-size: 16px; margin-right: 4px; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: #b4aa9e; font-size: 11px; }
.publisher { display: flex; align-items: center; gap: 6px; color: #8d775f; min-width: 0; overflow-wrap: anywhere; }
.product-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 16px 0; border-top: 1px solid #f6f2ec; }
.product-actions > div { display: flex; gap: 9px; }
.product-actions .button { font-size: 13px; min-height: 35px; padding: 5px 22px; }
.empty-state { text-align: center; padding: 70px 15px; color: #ac9b86; }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 15px; }
.empty-state h2 { font-size: 17px; color: #796651; }
.empty-state p { font-size: 13px; margin: 8px 0 22px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; }
.toast { position: fixed; left: 50%; bottom: 115px; transform: translateX(-50%); max-width: min(500px, 90vw); color: #fff; background: #5d4939ee; padding: 12px 20px; border-radius: 10px; z-index: 40; font-size: 13px; }
.detail-cover { display: block; width: 100%; max-height: 460px; object-fit: contain; border-radius: 10px; background: var(--soft); margin-bottom: 24px; }
.detail-hero h2 { font-size: 23px; margin-bottom: 10px; }
.manual-product-summary { color: #aaa; font-size: 15px; line-height: 1.6; margin-top: 10px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .manual-product-summary { font-size: 13px; line-height: 1.7; margin-top: 8px; }
}
.detail-publisher { justify-content: flex-end; margin-top: 18px; font-size: 12px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.role-description { margin: 14px 0; white-space: pre-wrap; }
.key-facts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 22px 0; padding: 18px; background: var(--soft); border-radius: 10px; }
.key-facts dt { color: var(--muted); font-size: 12px; }
.key-facts dd { margin: 5px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.role-card-image { display: block; max-width: 100%; height: auto; margin-bottom: 18px; }
.preview-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
.preview-item p { font-size: 14px; }
@media (max-width: 640px) {
    body { font-size: 14px; }
    .portal-header { padding: 0 16px; height: 70px; gap: 10px; }
    .portal-brand { font-size: 17px; gap: 6px; }
    .portal-brand > svg, .portal-brand img { width: 28px; height: 28px; }
    .portal-brand small { font-size: 9px; }
    .portal-identity { gap: 5px; font-size: 11px; }
    .portal-identity > span { max-width: 65px; }
    .portal-identity img { width: 26px; height: 26px; }
    .portal-identity form { margin-left: 2px; }
    .portal-main { padding: 22px 14px 110px; }
    h1 { font-size: 23px; }
    h2 { font-size: 17px; }
    .eyebrow { font-size: 10px; }
    .page-title { margin-bottom: 20px; }
    .page-title .button { padding: 7px 14px; min-height: 38px; font-size: 12px; }
    .surface { padding: 20px 16px; border-radius: 14px; margin-bottom: 16px; }
    .mode-switch { gap: 10px; }
    .mode-switch button { padding: 14px 10px; gap: 8px; font-size: 15px; }
    .mode-switch button svg { width: 22px; height: 22px; }
    .mode-switch button small { font-size: 9px; }
    .product-fields { grid-template-columns: 1fr; gap: 22px; }
    .cover-upload { max-width: 180px; }
    .field-grid { gap: 16px 12px; }
    .section-title { margin-bottom: 18px; }
    .section-title > span { font-size: 10px; }
    .role-tabs, .status-tabs { gap: 23px; }
    .role-tabs button, .status-tabs a { font-size: 15px; }
    .submit-bar { flex-direction: column; align-items: stretch; }
    .submit-bar > div .button { flex: 1; padding: 10px 16px; }
    .bottom-nav { gap: 95px; }
    .mine-surface { padding: 0 14px; }
    .my-product { grid-template-columns: 112px 1fr; gap: 0 14px; padding-top: 18px; }
    .my-product-cover { height: 130px; border-radius: 8px; }
    .my-product-info h2 { font-size: 15px; margin: 3px 0; }
    .my-product-info .muted { font-size: 11px; }
    .my-product-info .product-price { font-size: 23px; }
    .product-meta { flex-wrap: wrap; gap: 5px; margin-top: 6px; font-size: 10px; }
    .product-meta .publisher { margin-left: auto; }
    .product-actions { margin-top: 13px; padding: 13px 0; }
    .product-actions .button { padding: 4px 18px; font-size: 12px; }
    .key-facts { grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px; }
    .login-card { padding: 30px 24px; }
    .login-wrap { min-height: calc(100dvh - 230px); }
}
.partner-card-image { position:relative; width:100%; max-height:700px; overflow:auto; background:#211c18; }
.partner-card-image object { width:100%; height:100%; pointer-events:none; }
.partner-card-image img { display:block; width:100%; height:auto; }
.partner-card-image a { position:absolute; inset:0; cursor:zoom-in; }
.surface .rich-content img { max-width:100%; height:auto; }
.hero-subtabs { margin: 8px 0 18px; }


/* V0.2.43: partner-side operation notices are modal dialogs. */
.portal-message-dialog {
    width: min(440px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    border: 0;
    border-radius: 14px;
    padding: 0;
    color: #252525;
    box-shadow: 0 18px 60px rgba(0,0,0,.22);
}
.portal-message-dialog::backdrop { background: rgba(20,24,30,.48); }
.portal-message-fallback {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1000;
    transform: translate(-50%, -50%);
    margin: 0;
    background: #fff;
    box-shadow: 0 0 0 100vmax rgba(20, 24, 30, .48);
}
.portal-message-fallback[open] { display: block; }
.portal-message-content { padding: 24px; }
.portal-message-content h2 { margin: 0 0 12px; font-size: 18px; }
.portal-message-content p { margin: 0 0 22px; line-height: 1.75; overflow-wrap: anywhere; white-space:pre-line; }
.portal-message-content button { min-width: 96px; }


/* V0.2.45: new region and season metadata fields remain aligned with the existing form grid. */
.publish-form .field-grid input[name="region_code"],
.publish-form .field-grid input[name="season_count"] { max-width:100%; }

.portal-dialog-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:18px; }
.portal-dialog-actions [hidden] { display:none !important; }


/* V0.2.57: manual role details are image-only; no rich-text editor. */
.manual-detail-upload { display:flex; flex-direction:column; gap:14px; }
.manual-detail-upload-head { display:flex; align-items:baseline; flex-wrap:wrap; gap:12px; color:#51463b; }
.manual-detail-upload-head strong { font-size:16px; }
.manual-detail-upload-head span { color:var(--muted); font-size:12px; }
.manual-image-picker {
    position: relative;
    display: flex;
    width: 71px;
    min-height: 64px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border: 1px dashed #d8d2ca;
    border-radius: 8px;
    background: #fafafa;
    color: #8b8379;
    font-size: 12px;
    cursor: pointer;
}
.manual-image-picker svg { width: 18px; height: 18px; stroke-width: 1.5; }
.manual-image-picker input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.manual-role-image-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(132px,1fr)); gap:14px; }
.manual-role-image-tile { position:relative; min-width:0; height:142px; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:#fafafa; }
.manual-role-image-tile a { display:block; width:100%; height:100%; }
.manual-role-image-tile img { display:block; width:100%; height:100%; object-fit:contain; }
.manual-role-image-remove { position:absolute; top:6px; right:6px; width:28px; height:28px; border:0; border-radius:50%; background:rgba(35,35,35,.78); color:#fff; font-size:21px; line-height:1; }
.manual-image-empty { grid-column:1/-1; padding:20px 0; color:#aaa197; font-size:13px; }
.manual-title-preview { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; margin-top:18px; padding:14px 16px; border-radius:10px; background:#faf7f2; }
.manual-title-preview > span { color:#8d8174; font-size:13px; }
.manual-title-preview strong { color:#d97816; font-size:16px; }
.manual-title-preview small { color:#9b9288; font-size:12px; }
.manual-role-gallery { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; }
.manual-role-gallery > a { display:block; width:100%; text-align:center; }
.manual-role-gallery img { display:block; max-width:100%; width:100%; height:auto; margin:0 auto; border-radius:8px; }
@media (max-width:700px) {
    .manual-role-image-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .manual-role-image-tile { height:132px; }
    .manual-title-preview { align-items:flex-start; flex-direction:column; gap:4px; }
}

.account-card-gallery-frame{display:block;width:100%;min-height:360px;height:420px;border:0;overflow:hidden;background:#fff}

/* V0.2.62: visible cover action and consistent image-removal control. */
.cover-upload { display:flex; flex-direction:column; align-items:flex-start; gap:11px; }
.cover-file-button input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; z-index:1; }
.cover-file-button { position:relative; display:grid; place-items:center; width:71px; height:64px; border-radius:9px; background:#ebebeb; color:#b6b6b6; cursor:pointer; }
.cover-file-button:hover { background:#e5e5e5; }
.cover-file-button:focus-within { outline:2px solid #9a795d; outline-offset:3px; }
.cover-file-button svg { width:18px; height:18px; stroke-width:2.25; }
.cover-file-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.manual-role-image-remove { display:flex; align-items:center; justify-content:center; width:28px; height:28px; padding:0; border:1px solid rgba(255,255,255,.3); border-radius:50%; background:rgba(115,115,115,.9); color:#fff; box-shadow:0 1px 4px rgba(0,0,0,.18); }
.manual-role-image-remove svg { width:15px; height:15px; fill:none; stroke:#fff; stroke-width:2.2; stroke-linecap:round; }

.my-product-cover img[src^="/uploads/account-cards/"],
.cover-preview img[src^="/uploads/account-cards/"] { object-position: left top; }

button.portal-identity { padding: 4px; border: 0; background: none; color: inherit; cursor: pointer; }
.portal-settings-form label { display: grid; gap: 5px; margin-bottom: 12px; }
.portal-settings-form input[readonly] { background: #f5f2ee; }
.portal-settings-error:not(:empty) { color: #a42923; margin-bottom: 12px; }
#portal-account-dialog button { min-width: 0; }
