/* v2 앱 화면 공용 부품 - 작가 스튜디오(내 작품·작품 관리·작품/회차 등록·수정·원고 미리보기)와 MY·정산·커뮤니티·문의 등 (v2/app_base.html) */

:root {
  --danger: #f87171;
  --danger-weak: rgba(248, 113, 113, 0.14);
  --ok: #4ade80;
}
:root[data-theme="light"] {
  --danger: #dc2626;
  --danger-weak: rgba(220, 38, 38, 0.08);
  --ok: #16a34a;
}

/* ---------- 공통 틀 ---------- */
.studio-nav {
  display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 4px 0 24px; border-bottom: 1px solid var(--line);
}
.studio-nav::-webkit-scrollbar { display: none; }
.studio-nav a {
  flex: none; padding: 12px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: 14px; font-weight: 600; color: var(--text-3);
}
.studio-nav a:hover { color: var(--text); }
.studio-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand); }
.studio-brand {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px 0 2px; margin-right: 6px;
  font-size: 14px; font-weight: 800; color: var(--brand); border-right: 1px solid var(--line); height: 20px;
}
.studio-brand .icon { width: 18px; height: 18px; }

.studio-page { min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; margin-bottom: 10px; font-size: 13px; color: var(--text-3); }
.crumbs a { flex: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .icon { width: 14px; height: 14px; flex: none; }
.crumbs span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.studio-kicker { font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 4px; overflow-wrap: anywhere; }
.studio-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.studio-title .count { color: var(--text-3); font-weight: 700; }
.studio-sub { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.ep-badge {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--brand-weak); color: var(--brand); font-size: 14px; font-weight: 800; letter-spacing: 0;
}

.tabs.studio-tabs { margin-bottom: 20px; }
.studio-tabs .tab { display: inline-flex; align-items: center; }
.tab[aria-current="page"] { color: var(--text); background: var(--bg-elev-2); }

.btn .icon { width: 18px; height: 18px; }
.btn.is-danger, .icon-btn.is-danger { color: var(--danger); }
.btn.is-danger:hover, .icon-btn.is-danger:hover { background: var(--danger-weak); color: var(--danger); }
.btn[disabled], .icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn .icon { width: 18px; height: 18px; }

/* 처리 중 표시 (기존 스크립트가 div.loading 에 active 를 붙였다 뗀다) */
.appage .loading { display: none; }
.appage .loading.active {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--overlay);
}
.appage .loading i { width: 10px; height: 10px; border-radius: 999px; background: var(--brand); animation: studio-dot 1s ease-in-out infinite; }
.appage .loading i:nth-child(2) { animation-delay: .15s; }
.appage .loading i:nth-child(3) { animation-delay: .3s; }
@keyframes studio-dot { 0%, 80%, 100% { transform: scale(.55); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }

/* 빈 상태 */
.studio-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 20px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--bg-elev);
}
.studio-empty.is-compact { padding: 36px 20px; }
.studio-empty-icon { width: 64px; height: 64px; margin-bottom: 4px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-weak); color: var(--brand); }
.studio-empty-icon .icon { width: 28px; height: 28px; }
.studio-empty h2, .studio-empty h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.studio-empty h3 { font-size: 17px; }
.studio-empty p { max-width: 440px; font-size: 14px; color: var(--text-2); line-height: 1.6; }
.studio-empty .btn { margin-top: 8px; }

/* ---------- 내 작품 ---------- */
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.work-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l);
  transition: border-color .15s ease, transform .15s ease;
}
.work-card:hover { border-color: var(--bg-hover); transform: translateY(-2px); }
.work-cover { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-elev-2); }
.work-cover img { width: 100%; height: 100%; object-fit: cover; }
.work-cover .badge { position: absolute; top: 10px; left: 10px; }
.work-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px 16px; }
.work-title { font-size: 16px; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.work-title a:hover { color: var(--brand); }
.work-genres { display: flex; flex-wrap: wrap; gap: 6px; }
.work-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); }
.star { display: inline-flex; align-items: center; gap: 3px; color: var(--gold); font-weight: 700; }
.star .icon { width: 14px; height: 14px; }
.work-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 6px; }
.work-actions .work-char { grid-column: 1 / -1; }
.work-char-row { display: flex; gap: 8px; min-width: 0; }
.work-char-row .btn:first-child { flex: 1; min-width: 0; }
.work-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 300px; padding: 24px;
  text-align: center; color: var(--text-2); border: 1.5px dashed var(--line); border-radius: var(--radius-l);
  transition: border-color .15s ease, background .15s ease;
}
.work-add:hover { border-color: var(--brand); background: var(--brand-weak); color: var(--text); }
.work-add-icon { width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center; background: var(--brand-weak); color: var(--brand); flex: none; }
.work-add strong { font-size: 16px; color: var(--text); }
.work-add small { font-size: 13px; color: var(--text-3); }

/* ---------- 작품 관리 ---------- */
.mng-hero {
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; align-items: start; padding: 24px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l);
}
.mng-cover { aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--bg-elev-2); }
.mng-cover img { width: 100%; height: 100%; object-fit: cover; }
.mng-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mng-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.mng-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; overflow-wrap: anywhere; margin: 0; }
.mng-genres { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.mng-stats { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mng-stats > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; }
.mng-stats > div + div { border-left: 1px solid var(--line); }
.mng-stats strong { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 800; white-space: nowrap; }
.mng-stats strong.star { color: var(--gold); }
.mng-stats strong .icon { width: 16px; height: 16px; }
.mng-stats span { font-size: 12px; color: var(--text-3); }
.mng-synop { font-size: 14px; line-height: 1.7; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.mng-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.ep-section { margin-top: 32px; }
.ep-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.ep-head .section-title .count { color: var(--brand); margin-left: 4px; }
.ep-tools { display: flex; gap: 8px; }
.ep-list { list-style: none; margin: 0; padding: 0; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.ep-row { display: grid; grid-template-columns: 136px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; }
.ep-row + .ep-row { border-top: 1px solid var(--line); }
.ep-thumb { aspect-ratio: 400 / 236; overflow: hidden; border-radius: var(--radius-s); background: var(--bg-elev-2); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ep-line { display: flex; align-items: center; gap: 6px; }
.ep-no { font-size: 12px; font-weight: 800; color: var(--brand); }
.ep-title { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-date { font-size: 12px; color: var(--text-3); }
.ep-actions { display: flex; gap: 6px; }
.ep-note { margin-top: 10px; font-size: 12px; color: var(--text-3); }
.pill-sm { height: 20px; padding: 0 7px; font-size: 11px; }

/* 저작권 이력 · 원작품 팝업 (기존 스크립트가 jQuery fadeIn/fadeOut 으로 연다) */
.studio-modal { display: none; position: fixed; inset: 0; z-index: 110; overflow-y: auto; padding: 8vh 16px 32px; background: var(--overlay); }
.studio-modal-card {
  max-width: 640px; margin: 0 auto; padding: 20px 22px 22px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.studio-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.studio-modal-head h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; margin: 0; }
.studio-modal-head h2 .icon { color: var(--brand); }
.studio-modal-sub { margin: 4px 0 14px; font-size: 13px; color: var(--text-3); }
.studio-modal-empty { padding: 28px 0 12px; text-align: center; font-size: 14px; color: var(--text-3); }
.hist-list { list-style: none; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.hist-list > li + li { border-top: 1px solid var(--line); }
.hist-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; }
.hist-row:hover { background: var(--bg-elev-2); }
.hist-kind { font-size: 14px; font-weight: 700; }
.hist-date { font-size: 12px; color: var(--text-3); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row .icon { width: 16px; height: 16px; color: var(--text-3); transition: transform .15s ease; }
.hist-list > li.open .hist-row .icon { transform: rotate(180deg); }
.hist-detail { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px 12px; margin: 0; padding: 2px 14px 14px; font-size: 12px; }
.hist-detail dt { color: var(--text-3); }
.hist-detail dd { margin: 0; color: var(--text-2); word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hist-detail dd.is-text { font-family: inherit; font-size: 13px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }

/* ---------- 등록 · 수정 폼 ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form-card { display: flex; flex-direction: column; gap: 18px; padding: 22px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.form-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-card h2 { font-size: 16px; font-weight: 800; margin: 0; }
.form-card h2 small { margin-left: 6px; font-size: 13px; font-weight: 600; color: var(--text-3); }

.sfield { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sfield > label, .sfield-label { font-size: 14px; font-weight: 700; color: var(--text); }
.sfield-label small, .sfield > label small { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.req { margin-left: 2px; color: var(--brand); font-style: normal; }
.sfield input[type="text"], .sfield input[type="password"], .sfield input[type="tel"], .sfield input[type="number"], .sfield input[type="email"], .sfield input[type="datetime-local"],
.sfield select, .sfield textarea, .price-input input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sfield textarea { height: auto; min-height: 104px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.sfield input::placeholder, .sfield textarea::placeholder { color: var(--text-3); }
.sfield input:focus, .sfield select:focus, .sfield textarea:focus, .price-input input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.sfield-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); }
.field-note { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.counter { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--danger); font-weight: 700; }

/* 선택 칩 (radio / checkbox) - 숨긴 input 이 칩 밖으로 나가지 않게 label 을 relative 로 둔다 */
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cchip { position: relative; display: inline-flex; }
.cchip input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.cchip span {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cchip span:hover { color: var(--text); border-color: var(--text-3); }
.cchip input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cchip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.cchip input:disabled + span { opacity: .4; cursor: not-allowed; }
.cchip small { font-size: 11px; font-weight: 600; opacity: .8; }
.price-input { display: flex; align-items: center; gap: 8px; max-width: 220px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.price-input input { text-align: right; }

/* 이미지 올리기 */
.dropzone {
  position: relative; display: block; width: 100%; max-width: 440px; aspect-ratio: 4 / 3; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--text-3); border-radius: var(--radius); background: var(--bg);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.is-thumb { aspect-ratio: 400 / 236; max-width: 400px; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-weak); }
.dropzone .upload__img {
  position: absolute; inset: 0; z-index: 0; display: block; width: 100% !important; height: 100% !important;
  object-fit: cover; pointer-events: none;
}
.dropzone .upload__img[src$="none.png"] { display: none !important; }
.dropzone .file-uploads { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; width: auto; height: auto; padding: 0 !important; }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; text-align: center; color: var(--text-2); pointer-events: none; }
.dropzone-empty .icon { width: 28px; height: 28px; color: var(--brand); }
.dropzone-empty strong { font-size: 14px; color: var(--text); }
.dropzone-empty small { font-size: 12px; color: var(--text-3); }
.dropzone-change {
  position: absolute; left: 50%; bottom: 12px; z-index: 2; transform: translateX(-50%); display: none; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; background: rgba(8, 8, 10, .72); color: #fff; font-size: 12px; font-weight: 700; pointer-events: none; white-space: nowrap;
}
.upload__img:not([src$="none.png"]) ~ .dropzone-empty,
.upload__img:not([src$="none.png"]) ~ .file-uploads .dropzone-empty { opacity: 0; }
.upload__img:not([src$="none.png"]) ~ .dropzone-change { display: inline-flex; }
.dropzone:has(.upload__img:not([src$="none.png"])) { border-style: solid; }

.dropzone-wide {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--text-3); border-radius: var(--radius); background: var(--bg); color: var(--text-2);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone-wide:hover { border-color: var(--brand); background: var(--brand-weak); }
.dropzone-wide .icon { width: 28px; height: 28px; color: var(--brand); }
.dropzone-wide strong { font-size: 15px; color: var(--text); }
.dropzone-wide small { max-width: 520px; font-size: 12px; color: var(--text-3); line-height: 1.6; }

/* 원고 목록 */
.ms-list { list-style: none; margin: 0; padding: 0; max-height: 480px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.ms-item { display: grid; grid-template-columns: 28px 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; }
.ms-item + .ms-item { border-top: 1px solid var(--line); }
.ms-no { font-size: 12px; font-weight: 800; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.ms-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; object-position: top; background: var(--bg-elev-2); }
.ms-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-size { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ms-tools { display: flex; gap: 2px; }
.ms-tools .icon-btn { width: 32px; height: 32px; }
.ms-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }

/* 동의 */
.agree {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 13px; line-height: 1.55; color: var(--text-2);
}
.agree input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.agree strong { display: block; margin-bottom: 2px; font-size: 14px; color: var(--text); }

/* 오른쪽 안내 */
.side-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.side-label { font-size: 12px; font-weight: 700; color: var(--text-3); }
.side-card > strong { font-size: 15px; font-weight: 800; }
.side-card p { font-size: 13px; line-height: 1.6; color: var(--text-2); }
.side-card a.link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--brand); }
.side-card a.link .icon { width: 14px; height: 14px; }
.preview-cover { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--bg-elev-2); color: var(--text-3); font-size: 13px; }
.preview-cover img { width: 100%; height: 100%; object-fit: cover; }
.preview-cover .icon { width: 28px; height: 28px; }
.preview-title { font-size: 17px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.preview-title.is-empty, .preview-synop.is-empty { color: var(--text-3); }
.preview-genres { display: flex; flex-wrap: wrap; gap: 4px 8px; min-height: 0; }
.preview-synop { font-size: 13px; line-height: 1.6; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: var(--text-3); }
.checklist li { display: flex; align-items: center; gap: 8px; }
.checklist li::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--line);
  background: center / 11px no-repeat;
}
.checklist li.done { color: var(--text); }
.checklist li.done::before {
  border-color: var(--brand); background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E");
}

/* 아래 고정 버튼 줄 */
.action-bar {
  position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin-top: 20px; padding: 16px 0; background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.action-bar .spacer { flex: 1; }
.action-bar-note { margin-right: auto; font-size: 13px; color: var(--text-3); }
.action-bar .btn { min-width: 112px; }

/* 업로드 컴포넌트(input) 보관용 - display:none 이면 일부 브라우저에서 파일 선택 창이 열리지 않아 화면 밖에만 둔다 */
.upload-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 원고 미리보기 ---------- */
.pv { position: fixed; inset: 0; z-index: 105; }
.pv-backdrop { position: absolute; inset: 0; background: var(--overlay); }
.pv-layout {
  position: absolute; inset: 20px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow);
}
.pv-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px; background: var(--bg-elev); border-bottom: 1px solid var(--line); }
.pv-title { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pv-title strong { flex: none; font-weight: 800; color: var(--brand); }
.pv-title span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.pv-actions { display: flex; gap: 6px; flex: none; }
.pv-body { flex: 1; min-height: 0; display: flex; }
.pv-side { flex: none; width: 216px; overflow-y: auto; padding: 10px; background: var(--bg-elev); border-right: 1px solid var(--line); }
.pv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pv-item { display: flex; flex-direction: column; gap: 4px; }
.pv-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-s); background: var(--bg-elev-2); }
.pv-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pv-thumb:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.pv-no { position: absolute; top: 6px; left: 6px; }
.pv-tools { display: flex; justify-content: space-between; }
.pv-tools .icon-btn { width: 30px; height: 30px; }
.pv-main { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg-elev-2); }
.img-box { display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--bg); }
.img-box > img { display: block; width: 100%; height: auto; }
.pv-empty { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 100%; padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.pv-empty .icon { width: 32px; height: 32px; }
/* 터치툰 미리보기: 슬라이드 보기 (기존 스크립트가 .slide 의 display 를 바꿔 한 장씩 보여 준다) */
.pv-mode { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.pv-mode input { width: 16px; height: 16px; accent-color: var(--brand); }
.pv-slider { position: relative; display: flex; align-items: center; justify-content: center; padding: 16px 56px; }
.pv-slider .slide { display: none; max-width: 512px; width: 100%; }
.pv-slider .slide img { width: 100%; height: auto; border-radius: var(--radius); }
.pv-slide-nav { position: absolute; top: 50%; transform: translateY(-50%); background: var(--overlay); color: #fff; }
.pv-slide-nav.prev { left: 10px; }
.pv-slide-nav.next { right: 10px; }

/* ---------- 통계 · 표 · 탭 (대시보드 · 수익 현황) ---------- */
.page-meta { font-size: 13px; color: var(--text-3); }
.seg-tabs {
  display: inline-flex; gap: 4px; max-width: 100%; margin-bottom: 16px; padding: 4px; overflow-x: auto; scrollbar-width: none;
  border-radius: 999px; background: var(--bg-elev); border: 1px solid var(--line);
}
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs button { flex: none; height: 34px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--text-3); }
.seg-tabs button:hover { color: var(--text); }
.seg-tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 18px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.stat > span { font-size: 13px; color: var(--text-2); }
.stat strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat strong small { margin-left: 2px; font-size: 14px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.stat.is-brand strong { color: var(--brand); }
.panel { overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; font-weight: 800; margin: 0; }
.panel-head p { font-size: 12px; color: var(--text-3); }

/* 대시보드 작가 등급 (content/author_tiers.py): 공식 작가 추천 기준까지 남은 정도 */
.tier-panel { margin-bottom: 20px; }
.tier-panel .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.tier-goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 20px; margin: 0; padding: 16px 18px 4px; list-style: none; }
.tier-goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.tier-goal-head strong { font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.tier-goal-head small { font-size: 12px; font-weight: 600; color: var(--text-3); }
.tier-bar { height: 6px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; }
.tier-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.tier-goals .is-done .tier-bar span { background: var(--rookie); }
.tier-note { padding: 12px 18px 16px; font-size: 12px; line-height: 1.6; color: var(--text-3); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 10px 14px; text-align: right; white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--text-3); }
.data-table td { padding: 12px 14px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child, .data-table .t-left { text-align: left; }
.data-table .t-title { font-weight: 700; overflow-wrap: anywhere; }
.data-table tr.is-link { cursor: pointer; }
.data-table tr.is-link:hover td { background: var(--bg-elev-2); }
.data-table tr.is-selected td { background: var(--brand-weak); }
.data-empty { padding: 36px 16px; text-align: center; font-size: 14px; color: var(--text-3); }
.tone-up { color: var(--ok); font-weight: 700; }
.tone-down { color: var(--danger); font-weight: 700; }
.tone-info { color: #60a5fa; font-weight: 700; }
:root[data-theme="light"] .tone-info { color: #2563eb; }

/* ---------- MY ---------- */
.profile-card { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 20px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-l); }
.avatar.lg { width: 56px; height: 56px; flex: none; font-size: 22px; }
.profile-card strong { display: block; font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.profile-card div span { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; min-width: 0; }
.inline-field .btn { flex: none; height: 48px; }
.sfield select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d8d98' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.link-tile {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 14px; font-size: 14px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.link-tile:hover { border-color: var(--brand); color: var(--brand); }
.link-tile .icon { color: var(--brand); }
.pw-hint { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-3); }
.pw-hint li.is-ok { color: var(--ok); }
.pw-hint li::before { content: "· "; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.my-page .form-layout { grid-template-columns: 320px minmax(0, 1fr); }
.my-page .link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- 작가 정보 ---------- */
.writer-welcome { margin-bottom: 16px; border-color: var(--brand); background: var(--brand-weak); }
.avatar-row { display: flex; align-items: center; gap: 16px; }
.avatar-drop, .banner-drop {
  position: relative; display: flex !important; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--text-3); background: var(--bg); transition: border-color .15s ease, background .15s ease;
}
.avatar-drop { flex: none; width: 112px; height: 112px; border-radius: 999px; }
.banner-drop { width: 100%; aspect-ratio: 32 / 5; min-height: 96px; border-radius: var(--radius); }
.avatar-drop:hover, .banner-drop:hover { border-color: var(--brand); background: var(--brand-weak); }
.avatar-drop img, .banner-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-drop:has(img), .banner-drop:has(img) { border-style: solid; }
.writer-banner { aspect-ratio: 32 / 9; overflow: hidden; border-radius: var(--radius); background: linear-gradient(135deg, var(--brand-weak), var(--bg-elev-2)); }
.writer-banner img { width: 100%; height: 100%; object-fit: cover; }
.writer-id { display: flex; align-items: center; gap: 10px; margin-top: -30px; padding: 0 12px; }
.writer-avatar {
  flex: none; width: 60px; height: 60px; overflow: hidden; display: grid; place-items: center; border-radius: 999px;
  border: 3px solid var(--bg-elev); background: var(--brand-weak); color: var(--brand); font-size: 22px; font-weight: 800;
}
.writer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.writer-id strong { margin-top: 26px; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }

/* ---------- 반응형 ---------- */
@media (max-width: 1023px) {
  .studio-nav { margin: 0 calc(var(--gutter) * -1) 18px; padding: 0 var(--gutter); }
  .studio-title { font-size: 24px; }
  .form-layout, .my-page .form-layout { grid-template-columns: 1fr; }
  .form-side { position: static; }
  .mng-hero { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 20px; padding: 18px; }
  .action-bar { bottom: calc(60px + env(safe-area-inset-bottom)); padding: 12px 0; }
  .action-bar .btn { flex: 1; min-width: 0; }
  .action-bar .spacer, .action-bar-note { display: none; }
}
@media (max-width: 767px) {
  .mng-hero { grid-template-columns: 1fr; padding: 16px; }
  .mng-title { font-size: 22px; }
  .pv-layout { inset: 0; border: 0; border-radius: 0; }
  .pv-head { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .pv-title { flex-basis: 100%; }
  .pv-actions { margin-left: auto; }
  .pv-body { flex-direction: column-reverse; }
  .pv-side { width: auto; overflow-x: auto; overflow-y: hidden; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .pv-list { flex-direction: row; gap: 8px; }
  .pv-item { flex: none; width: 96px; }
  .pv-tools .icon-btn { width: 24px; height: 24px; }
  .pv-tools .icon-btn .icon { width: 15px; height: 15px; }
}
@media (max-width: 599px) {
  .studio-head { margin-bottom: 16px; }
  .studio-title { font-size: 22px; }
  .studio-head .btn { height: 36px; padding: 0 14px; font-size: 13px; }
  .work-grid { grid-template-columns: 1fr; gap: 12px; }
  .work-card { flex-direction: row; border-radius: var(--radius); }
  .work-card:hover { transform: none; }
  .work-cover { flex: none; width: 116px; aspect-ratio: auto; }
  .work-body { padding: 12px; gap: 6px; }
  .work-title { font-size: 15px; }
  .work-add { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 0; padding: 16px; text-align: left; border-radius: var(--radius); }
  .work-add > span:last-child { display: flex; flex-direction: column; }
  .work-add-icon { width: 44px; height: 44px; }
  .mng-stats > div { padding: 8px 10px; }
  .mng-stats strong { font-size: 14px; }
  .mng-actions .btn { flex: 1 1 calc(50% - 4px); }
  .ep-head .section-title { font-size: 17px; }
  .ep-row { grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; padding: 12px; }
  .ep-thumb { grid-row: span 2; align-self: start; }
  .ep-actions { grid-column: 2; }
  .ep-actions .btn { height: 30px; padding: 0 12px; font-size: 12px; }
  .form-card { padding: 16px; gap: 16px; border-radius: var(--radius); }
  .dropzone, .dropzone.is-thumb { max-width: none; }
  .ms-item { grid-template-columns: 20px 40px minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
  .ms-size { display: none; }
  .ms-tools .icon-btn { width: 30px; height: 30px; }
  .hist-detail { grid-template-columns: 1fr; gap: 2px; }
  .hist-detail dd { margin-bottom: 8px; }
  .studio-modal { padding: 16px 12px; }
  .studio-modal-card { padding: 16px; }
}
@media (max-width: 767px) {
  /* 좁은 화면에서는 표의 각 행을 카드로 (td 의 data-label 을 항목 이름으로) */
  .data-table.is-cards thead { display: none; }
  .data-table.is-cards, .data-table.is-cards tbody, .data-table.is-cards tr, .data-table.is-cards td { display: block; width: 100%; }
  .data-table.is-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; padding: 12px 16px; border-top: 1px solid var(--line); }
  .data-table.is-cards tr:first-child { border-top: 0; }
  .data-table.is-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .data-table.is-cards td::before { content: attr(data-label); flex: none; font-size: 13px; color: var(--text-3); text-align: left; }
  .data-table.is-cards td:first-child { grid-column: 1 / -1; padding-bottom: 6px; font-size: 15px; text-align: left; }
  .data-table.is-cards td:first-child::before { display: none; }
  .data-table.is-cards tr.is-link:hover td { background: none; }
  .stat { padding: 14px; }
  .stat strong { font-size: 20px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 599px) {
  .inline-field { flex-wrap: wrap; }
  .inline-field .btn { flex: 1 1 100%; }
}

/* 회차 예약 공개 시각 */
.schedule-at { display: grid; gap: 6px; margin-top: 10px; max-width: 320px; }
