:root {
  --background: #f6f6f8;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --foreground: #18181b;
  --muted-foreground: #666670;
  --border: #e3e3e8;
  --border-strong: #c9c9d1;
  --primary: #18181b;
  --primary-foreground: #ffffff;
  --accent: #e73978;
  --accent-soft: #fff0f5;
  --success: #16794b;
  --success-soft: #eaf8f0;
  --warning: #9a5c00;
  --warning-soft: #fff6df;
  --danger: #b4232e;
  --danger-soft: #fff0f1;
  --shadow: 0 14px 40px rgba(24, 24, 27, .06);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --focus: 0 0 0 3px rgba(231, 57, 120, .28);
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--background); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--foreground); background: var(--background); font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif; font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
button, label, select, input[type="range"] { touch-action: manipulation; }
button, select, label, input[type="radio"], input[type="checkbox"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .48; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 1000; top: 12px; left: 12px; transform: translateY(-150%); padding: 10px 14px; border-radius: 8px; color: #fff; background: #111; }
.skip-link:focus { transform: translateY(0); }

.app-header { position: sticky; z-index: 50; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px max(24px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid rgba(227, 227, 232, .85); background: rgba(246, 246, 248, .9); backdrop-filter: blur(18px); }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #fff; background: var(--primary); }
.brand-mark svg { width: 25px; height: 25px; }
.brand-block h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.eyebrow, .section-kicker { margin: 0 0 2px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.header-status { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 14px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-actions .button { min-height: 44px; padding: 8px 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #a1a1aa; box-shadow: 0 0 0 4px rgba(161, 161, 170, .14); }
.status-dot.connected { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 121, 75, .13); }
.status-dot.warning { background: #d88b12; box-shadow: 0 0 0 4px rgba(216, 139, 18, .14); }

.app-shell { width: min(1180px, calc(100% - 48px)); margin: 32px auto 80px; }
.hero-panel { display: grid; grid-template-columns: 1.35fr .8fr; gap: 32px; align-items: end; min-height: 330px; padding: 48px; overflow: hidden; border-radius: 30px; color: #fff; background: radial-gradient(circle at 84% 18%, rgba(231, 57, 120, .3), transparent 34%), linear-gradient(135deg, #111114, #29292f); box-shadow: 0 30px 80px rgba(24, 24, 27, .18); }
.hero-panel h2 { max-width: 700px; margin: 10px 0 18px; font-size: clamp(40px, 5.4vw, 68px); line-height: 1.04; letter-spacing: -.055em; }
.hero-copy { max-width: 640px; margin: 0; color: #cfcfd7; font-size: 17px; }
.auto-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 112px; padding: 22px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; background: rgba(255, 255, 255, .08); }
.auto-card p { margin: 0; color: #cfcfd7; font-size: 13px; }
.auto-card .auto-label { margin-bottom: 6px; color: #fff; font-size: 17px; font-weight: 750; }
.auto-card-actions { display: flex; align-items: center; gap: 12px; }
.auto-schedule-button { min-height: 38px; padding: 8px 12px; color: #fff; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .08); font-size: 12px; }
.auto-schedule-button:hover { border-color: rgba(255, 255, 255, .48); background: rgba(255, 255, 255, .15); }
.switch { display: inline-flex; min-width: 56px; min-height: 44px; align-items: center; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; display: block; width: 54px; height: 32px; border-radius: 999px; background: #5a5a63; transition: background .2s ease; }
.switch-thumb { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(255, 255, 255, .32); }

.alert, .notice { margin-top: 20px; padding: 14px 18px; border: 1px solid; border-radius: 13px; font-weight: 650; }
.alert { color: var(--danger); border-color: #f3b8bf; background: var(--danger-soft); }
.notice { color: var(--success); border-color: #a8d9bd; background: var(--success-soft); }
.panel { margin-top: 24px; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 28px; }
.panel-heading h2 { margin: 0; font-size: 27px; line-height: 1.2; letter-spacing: -.035em; }
.panel-heading p:not(.section-kicker) { margin: 6px 0 0; color: var(--muted-foreground); }
.step-number { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: var(--accent); background: var(--accent-soft); font-size: 13px; font-weight: 850; }

.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; font-weight: 750; transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease; }
.button-primary { color: var(--primary-foreground); background: var(--primary); }
.button-primary:hover { background: #34343a; }
.button-secondary { border-color: var(--border); color: var(--foreground); background: var(--surface); }
.button-secondary:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.button-ghost { color: var(--muted-foreground); background: transparent; }
.button-ghost:hover { color: var(--foreground); background: var(--surface-soft); }
.button-danger-ghost { color: var(--danger); }
.button-danger-ghost:hover { color: var(--danger); background: var(--danger-soft); }
.button-large { min-height: 54px; padding-inline: 24px; }
.button-large svg { width: 20px; height: 20px; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.account-card { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.account-card-header, .section-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-card-header { margin-bottom: 18px; }
.account-name { margin: 0; font-weight: 780; }
.account-provider { margin: 2px 0 0; color: var(--muted-foreground); font-size: 13px; }
.badge { display: inline-flex; min-height: 28px; align-items: center; padding: 4px 9px; border-radius: 999px; color: #52525b; background: #ededf0; font-size: 12px; font-weight: 800; }
.badge.connected, .badge-completed { color: var(--success); background: var(--success-soft); }
.badge.manual, .badge.credentials, .badge.disconnected { color: var(--warning); background: var(--warning-soft); }
.badge.error, .badge.offline, .badge-failed { color: var(--danger); background: var(--danger-soft); }
.badge-running { color: #2458a7; background: #edf4ff; }
.badge-deleted { color: var(--muted-foreground); background: var(--surface-soft); }
.badge-publishing { color: #2458a7; background: #edf4ff; }
.badge-awaiting_approval { color: var(--warning); background: var(--warning-soft); }
.badge-discarded { color: var(--muted-foreground); background: #ededf0; }
.badge-cancelled { color: var(--muted-foreground); background: var(--surface-soft); }
.field { display: grid; gap: 7px; margin-top: 13px; }
.field label, .field-label, .custom-topic label, .segmented-field legend { color: var(--foreground); font-size: 13px; font-weight: 750; }
.field input, .custom-topic input, select, textarea { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; color: var(--foreground); background: var(--surface); }
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.saved-password, .helper { margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }

.topic-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; padding: 18px; border-radius: var(--radius-md); background: var(--surface-soft); }
.compact-field { margin: 0; }
.segmented-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented-field legend { margin-bottom: 7px; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.segmented input, .choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; min-height: 38px; place-items: center; padding: 4px 10px; border-radius: 8px; color: var(--muted-foreground); font-size: 13px; font-weight: 700; transition: color .18s ease, background .18s ease; }
.segmented label:has(input:checked) span { color: #fff; background: var(--primary); }
.segmented label:has(input:focus-visible) span { box-shadow: var(--focus); }
.auto-topic-option { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.auto-topic-option input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--accent); }
.auto-topic-option span { display: grid; gap: 2px; }
.auto-topic-option strong { font-size: 14px; }
.auto-topic-option small { color: var(--muted-foreground); font-size: 12px; }
.empty-state { display: flex; min-height: 145px; align-items: center; justify-content: center; gap: 15px; margin-top: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--muted-foreground); background: #fcfcfd; text-align: left; }
.empty-state svg { width: 38px; height: 38px; color: #a4a4ad; }
.empty-state p { margin: 0; }
.topic-meta { margin-top: 18px; color: var(--muted-foreground); font-size: 13px; font-weight: 650; }
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.topic-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.topic-card:hover { border-color: var(--border-strong); }
.topic-card:has(.topic-option[aria-checked="true"]) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.topic-option { display: grid; width: 100%; min-height: 174px; align-content: start; gap: 10px; padding: 16px; border: 0; color: var(--foreground); background: transparent; text-align: left; cursor: pointer; }
.topic-option:focus-visible { outline: none; box-shadow: inset var(--focus); }
.topic-option strong { font-size: 16px; line-height: 1.4; }
.topic-option p { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
.topic-keywords { color: var(--primary); font-size: 12px; font-weight: 750; line-height: 1.5; }
.topic-option small { color: var(--muted-foreground); font-size: 12px; font-weight: 700; }
.topic-origins { display: grid; border-top: 1px solid var(--border); }
.topic-origin { display: flex; min-height: 42px; align-items: center; padding: 8px 16px; color: var(--primary); font-size: 12px; font-weight: 750; text-underline-offset: 3px; overflow-wrap: anywhere; word-break: break-all; }
.topic-origin + .topic-origin { border-top: 1px solid var(--border); }
.custom-topic { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; margin-top: 16px; }
.source-mode { margin: 0 0 16px; padding: 0; border: 0; }
.source-mode > legend { margin-bottom: 9px; font-size: 13px; font-weight: 750; }
.source-mode .choice-card { min-height: 68px; }
.topic-source-picker { margin: 0 0 16px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.topic-source-picker > legend { padding: 0 5px; color: var(--foreground); font-size: 13px; font-weight: 800; }
.topic-source-card { min-height: 92px; cursor: pointer; }
.topic-source-card em { color: var(--accent); font-size: 11px; font-style: normal; font-weight: 800; letter-spacing: .02em; }
.source-help { margin: 10px 2px 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.search-progress { margin-top: 12px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.search-progress-heading { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.search-progress-spinner { width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: search-spin .8s linear infinite; }
.search-progress.done .search-progress-spinner, .search-progress.error .search-progress-spinner { animation: none; border-color: var(--success); }
.search-progress.error .search-progress-spinner { border-color: var(--danger); }
.search-progress ol { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.search-progress li { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 12px; line-height: 1.4; }
.search-progress li::before { content: ''; width: 8px; height: 8px; flex: 0 0 auto; border: 1.5px solid var(--border-strong); border-radius: 50%; }
.search-progress li.active { color: var(--foreground); font-weight: 750; }
.search-progress li.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-progress li.done::before { border-color: var(--success); background: var(--success); }
.search-progress li.error { color: var(--danger); }
.search-progress li.error::before { border-color: var(--danger); background: var(--danger); }
@keyframes search-spin { to { transform: rotate(360deg); } }
.sns-topic-intro { margin-bottom: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.sns-topic-intro h3 { margin: 2px 0 4px; font-size: 18px; }
.sns-topic-intro p:last-child { margin: 0; color: var(--muted-foreground); font-size: 13px; }
.sns-login-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.sns-login-panel > div:first-child { min-width: 0; }
.sns-login-panel strong { font-size: 14px; }
.sns-login-panel p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.45; }
.sns-login-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.sns-login-button { display: grid; min-width: 124px; min-height: 48px; align-content: center; gap: 2px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--foreground); background: var(--surface-soft); text-align: left; cursor: pointer; }
.sns-login-button:hover:not(:disabled) { border-color: var(--primary); }
.sns-login-button:focus-visible { outline: none; box-shadow: var(--focus); }
.sns-login-button span { font-size: 13px; font-weight: 850; }
.sns-login-button em { color: var(--muted-foreground); font-size: 11px; font-style: normal; font-weight: 650; }
.sns-login-button.connected { border-color: var(--success); background: var(--success-soft); cursor: default; }
.sns-login-button.connected em { color: var(--success); }
.sns-login-button:disabled { opacity: .78; }
.sns-topic-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px auto; gap: 14px; align-items: end; padding: 18px; border-radius: var(--radius-md); background: var(--surface-soft); }
.sns-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.sns-topic-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.sns-topic-card:hover { border-color: var(--border-strong); }
.sns-topic-card:has(.sns-topic-select[aria-checked="true"]) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.sns-topic-select { display: grid; width: 100%; min-height: 164px; align-content: start; gap: 10px; padding: 16px; border: 0; color: var(--foreground); background: transparent; text-align: left; cursor: pointer; }
.sns-topic-select:focus-visible { outline: none; box-shadow: inset var(--focus); }
.sns-topic-option-head { display: flex; align-items: center; gap: 8px; }
.sns-platform-badge { padding: 4px 8px; border-radius: 999px; color: var(--foreground); background: #ededf0; font-size: 11px; font-weight: 850; }
.sns-platform-badge.threads { color: #7b2450; background: #fff0f7; }
.sns-topic-date { margin-left: auto; color: var(--muted-foreground); font-size: 11px; font-weight: 650; }
.sns-topic-select strong { font-size: 16px; line-height: 1.4; }
.sns-topic-select p { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
.sns-topic-author { color: var(--muted-foreground); font-size: 12px; font-weight: 700; }
.sns-topic-origin { display: flex; min-height: 46px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border); color: var(--primary); font-size: 12px; font-weight: 750; text-underline-offset: 3px; overflow-wrap: anywhere; word-break: break-all; }
.direct-flow { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.direct-flow > div { position: relative; display: grid; min-height: 78px; align-content: center; gap: 3px; padding: 14px 14px 14px 54px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.direct-flow span { position: absolute; top: 16px; left: 14px; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: var(--primary-foreground); background: var(--primary); font-size: 12px; font-weight: 850; }
.direct-flow strong { font-size: 13px; }
.direct-flow small { color: var(--muted-foreground); font-size: 11px; }
.draft-source { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 14px; }
.draft-copy, .draft-photos { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.draft-copy .field:first-child { margin-top: 0; }
.optional { margin-left: 5px; color: var(--muted-foreground); font-size: 11px; font-weight: 600; }
.draft-meta, .field-label-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.draft-meta output, .field-label-row output { flex: 0 0 auto; color: var(--muted-foreground); font-size: 12px; font-weight: 750; }
.field-label-row .field-label { margin-bottom: 9px; }
.upload-zone { position: relative; display: grid; min-height: 154px; place-items: center; align-content: center; gap: 10px; padding: 22px; overflow: hidden; border: 1.5px dashed var(--border-strong); border-radius: 14px; color: var(--muted-foreground); background: var(--surface); text-align: center; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.upload-zone:hover, .upload-zone:focus-within { border-color: var(--accent); color: var(--foreground); background: var(--accent-soft); }
.upload-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-zone svg { width: 34px; height: 34px; color: var(--accent); }
.upload-zone span { display: grid; gap: 2px; }
.upload-zone strong { font-size: 14px; }
.upload-zone small { font-size: 12px; }
.upload-helper { margin-top: 9px; }
.draft-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.draft-photo { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.draft-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.draft-photo video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #111; }
.draft-photo-media-type { position: absolute; top: 9px; left: 9px; padding: 4px 7px; border-radius: 999px; color: #fff; background: rgba(15, 15, 18, .76); font-size: 10px; font-weight: 800; }
.draft-photo figcaption { overflow: hidden; padding: 8px 10px; color: var(--muted-foreground); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.draft-photo button { position: absolute; top: 6px; right: 6px; display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 50%; color: #fff; background: rgba(15, 15, 18, .76); }
.draft-photo button:hover { background: rgba(180, 35, 46, .92); }
.draft-photo button svg { width: 18px; height: 18px; }
.social-compose-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 14px; }
.social-compose-copy, .social-compose-media { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.social-platforms { margin: 0 0 16px; padding: 0; border: 0; background: transparent; }
.social-platforms legend { margin-bottom: 9px; font-size: 13px; font-weight: 750; }
.social-topic-field { margin: 0; }
.social-topic-field .field-label-row { align-items: center; margin-bottom: 7px; }
.social-topic-field .field-label-row label { margin: 0; }
.button-compact { min-height: 38px; padding: 7px 11px; font-size: 11px; white-space: nowrap; }
.social-media-item video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #111; }
.social-footer { margin-top: 16px; }
#social-draft-status:empty { display: none; }
.over-limit { color: var(--danger) !important; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-section { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.settings-section.span-two { grid-column: 1 / -1; }
.settings-section h3 { margin: 0 0 14px; font-size: 15px; }
.section-label-row .field-label { margin: 0; }
.section-label-row output { color: var(--accent); font-weight: 850; }
.choice-cards { display: grid; gap: 9px; }
.choice-cards.two { grid-template-columns: repeat(2, 1fr); }
.choice-cards.three { grid-template-columns: repeat(3, 1fr); }
.choice-cards.four { grid-template-columns: repeat(4, 1fr); }
.choice-card { position: relative; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.choice-card:hover { border-color: var(--border-strong); }
.choice-card:has(input:checked) { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.choice-card:has(input:focus-visible) { box-shadow: var(--focus); }
.choice-card:has(input:disabled) { cursor: not-allowed; opacity: .55; }
.choice-card span { display: grid; gap: 3px; }
.choice-card strong { font-size: 14px; }
.choice-card small { color: var(--muted-foreground); font-size: 12px; }
.choice-card em { padding: 3px 7px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-style: normal; font-weight: 850; }
.field-label { display: block; margin-bottom: 9px; font-size: 15px; }
.field-label span { margin-left: 5px; color: var(--muted-foreground); font-size: 11px; }
input[type="range"] { width: 100%; height: 34px; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; margin-top: -5px; color: var(--muted-foreground); font-size: 11px; }
.settings-section > .helper { margin-top: 9px; }
.model-picker { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.model-picker-control { display: grid; grid-template-columns: auto auto minmax(180px, 1fr); gap: 9px; }
.model-picker .helper { margin-top: 8px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 24px; padding: 22px 24px; border-radius: var(--radius-md); color: #d5d5dc; background: var(--primary); }
.form-footer p { margin: 3px 0 0; font-size: 13px; }
.form-footer .footer-title { margin: 0; color: #fff; font-size: 15px; font-weight: 780; }
.form-footer .button-primary { color: var(--foreground); background: #fff; }
.form-footer .button-primary:hover { background: #f2f2f4; }

.job-panel pre { min-height: 180px; max-height: 400px; overflow: auto; margin: 16px 0; padding: 18px; border-radius: 14px; color: #e8e8ed; background: #151519; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.job-progress-status { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 20px 0 10px; }
.job-progress-status strong { font-size: 15px; }
.job-progress-status span { flex: 0 0 auto; color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
.job-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.draft-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.draft-empty { grid-column: 1 / -1; padding: 32px 20px; border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--muted-foreground); background: var(--surface-soft); text-align: center; }
.draft-card { display: grid; min-width: 0; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.draft-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.draft-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.draft-card h3 { margin: 0; font-size: 17px; line-height: 1.35; letter-spacing: -.015em; overflow-wrap: anywhere; }
.draft-card time, .draft-card-meta { color: var(--muted-foreground); font-size: 12px; }
.draft-card time { flex: 0 0 auto; white-space: nowrap; }
.draft-card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; }
.draft-card-error { margin: 0; padding: 10px 12px; border-radius: 10px; color: var(--danger); background: var(--danger-soft); font-size: 12px; line-height: 1.5; }
.draft-card .button { width: 100%; }
.sns-research { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-soft); }
.sns-research h3 { margin: 0; font-size: 18px; }
.sns-research > div:first-child > p:last-child { margin: 4px 0 14px; color: var(--muted-foreground); font-size: 13px; }
.sns-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sns-source-card { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.sns-source-meta { display: flex; align-items: center; gap: 8px; }
.sns-group { padding: 3px 7px; border-radius: 999px; color: #7b2450; background: #fff0f7; font-size: 11px; font-weight: 800; }
.sns-source-status { margin-left: auto; padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.sns-source-status.used { color: var(--success); background: var(--success-soft); }
.sns-source-status.unused { color: var(--muted-foreground); background: #ededf0; }
.sns-source-material, .sns-source-origin { margin: 12px 0 0; color: var(--foreground); font-size: 13px; overflow-wrap: anywhere; }
.sns-source-material b, .sns-source-origin b { display: block; margin-bottom: 3px; color: var(--muted-foreground); font-size: 11px; letter-spacing: .04em; }
.sns-source-origin a { display: inline-flex; min-height: 44px; align-items: center; color: var(--primary); font-weight: 700; text-underline-offset: 3px; overflow-wrap: anywhere; word-break: break-all; }
.progress-track { height: 5px; overflow: hidden; border-radius: 999px; background: #ededf0; }
.progress-track span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--accent); animation: progress 1.6s ease-in-out infinite alternate; }
.progress-track span.done { width: 100%; animation: none; background: var(--success); }
.progress-track span.failed { width: 100%; animation: none; background: var(--danger); }
.progress-track span.review { width: 100%; animation: none; background: var(--warning); }
.progress-track span.deleted { width: 100%; animation: none; background: var(--muted-foreground); }
.progress-track span.determinate { animation: none; transition: width .4s ease; }
.progress-track span.cancelled { width: 100%; animation: none; background: var(--muted-foreground); }
@keyframes progress { from { transform: translateX(-35%); } to { transform: translateX(175%); } }

::backdrop { background: rgba(15, 15, 18, .56); backdrop-filter: blur(4px); }
dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; color: var(--foreground); background: var(--surface); box-shadow: 0 30px 100px rgba(0, 0, 0, .25); }
.dialog-card { padding: 30px; text-align: center; }
.dialog-card h2 { margin: 15px 0 8px; font-size: 24px; letter-spacing: -.03em; }
.dialog-card p { margin: 0; color: var(--muted-foreground); white-space: pre-line; }
.dialog-icon { display: grid; width: 52px; height: 52px; margin: 0 auto; place-items: center; border-radius: 16px; color: var(--accent); background: var(--accent-soft); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 24px; }
.setup-download { width: fit-content; min-height: 38px; margin: -8px 0 16px; padding: 7px 12px; font-size: 12px; }
#close-setup[hidden] + .button { grid-column: 1 / -1; }
.setup-dialog-card { text-align: left; }
#setup-dialog { width: min(760px, calc(100% - 32px)); }
.setup-dialog-card .dialog-icon { margin: 0; }
.setup-dialog-card h2 { margin-top: 10px; }
.setup-system { margin: 18px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted-foreground); background: var(--surface-soft); font-size: 13px; }
.setup-blog-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.setup-blog { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 15px; }
#schedule-dialog { width: min(780px, calc(100% - 32px)); }
.schedule-dialog-card { text-align: left; }
.schedule-list { display: grid; gap: 12px; margin-top: 20px; }
.schedule-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.schedule-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.schedule-card-heading h3 { margin: 0; font-size: 16px; }
.schedule-count-field { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 700; }
.schedule-count-field select { width: 84px; min-height: 38px; }
.schedule-time-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.schedule-time-field { display: grid; gap: 6px; color: var(--muted-foreground); font-size: 12px; font-weight: 700; }
.schedule-time-field input { min-width: 0; }
.setup-blog > label { display: grid; gap: 6px; margin-top: 12px; color: var(--muted-foreground); font-size: 12px; font-weight: 700; }
.setup-blog .setup-enable { display: flex; align-items: center; gap: 8px; margin-top: 0; color: var(--foreground); font-size: 14px; }
.setup-blog:has(input[name="enabled"]:not(:checked)) > label:not(.setup-enable) { opacity: .45; }
.setup-blog input[type="text"] { min-width: 0; }
.setup-dialog-card > .helper { margin-top: 16px; }
#preview-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; }
.preview-dialog-card { max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; text-align: left; }
.preview-dialog-card h2 { margin: 2px 0 6px; }
.preview-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.preview-dialog-header > div { min-width: 0; }
.preview-fields { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; margin-top: 22px; }
.preview-fields label { display: grid; gap: 7px; color: var(--foreground); font-size: 13px; font-weight: 750; }
.preview-fields input { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.preview-helper { margin-top: 14px !important; font-size: 13px; }
.preview-segments { display: grid; gap: 14px; margin-top: 16px; }
.preview-text-block { width: 100%; min-height: 150px; resize: vertical; padding: 16px; border: 1px solid var(--border); border-radius: 13px; color: var(--foreground); background: var(--surface-soft); font: inherit; line-height: 1.75; }
.preview-text-block:focus { border-color: var(--border-strong); background: var(--surface); }
.preview-image { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.preview-image img { display: block; width: 100%; max-height: 580px; object-fit: contain; border-radius: 9px; background: #111; }
.preview-image figcaption { margin-top: 8px; color: var(--muted-foreground); font-size: 12px; }
.preview-image-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.preview-image-actions .button { min-height: 40px; cursor: pointer; }
.preview-image-replace { display: inline-flex; align-items: center; justify-content: center; }
.preview-image-replace.is-busy { cursor: wait; opacity: .6; }
.preview-image.is-removed { border-color: var(--danger); background: var(--danger-soft); }
.preview-image.is-removed img { opacity: .25; filter: grayscale(1); }
.preview-image.is-removed figcaption { color: var(--danger); font-weight: 750; }
.preview-video { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.preview-video video { display: block; width: 100%; max-height: 580px; border-radius: 9px; background: #111; }
.preview-video figcaption { margin-top: 8px; color: var(--muted-foreground); font-size: 12px; }
.preview-link { display: flex; min-height: 48px; align-items: center; padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px; color: var(--primary); font-weight: 700; overflow-wrap: anywhere; }
.preview-status { min-height: 24px; margin-top: 14px !important; color: var(--success) !important; font-size: 13px; font-weight: 700; }
.preview-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: auto 1fr 1.25fr; gap: 9px; margin: 10px -4px -4px; padding: 12px 4px 4px; border-top: 1px solid var(--border); background: var(--surface); }

#social-review-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; }
.social-review-card { text-align: left; }
.social-review-media { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.social-review-posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.social-review-post { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.social-review-post h3 { margin: 0; font-size: 17px; }
.social-review-post output { color: var(--muted-foreground); font-size: 12px; font-weight: 750; }
.social-review-post textarea { width: 100%; min-height: 150px; margin-top: 10px; resize: vertical; padding: 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--foreground); background: var(--surface); font: inherit; line-height: 1.65; }
.social-review-post textarea:focus { border-color: var(--border-strong); }
.social-review-post textarea:disabled { opacity: .65; }
.social-review-post .helper { margin-top: 8px; }
.social-review-card .preview-actions { grid-template-columns: 1fr 1.5fr; }
@media (max-width: 900px) {
  .hero-panel { grid-template-columns: 1fr; min-height: 0; padding: 36px; }
  .auto-card { max-width: 520px; }
  .account-grid, .topic-grid, .sns-topic-grid, .setup-blog-list { grid-template-columns: 1fr 1fr; }
  .topic-toolbar { grid-template-columns: 1fr; }
  .topic-toolbar .button { width: 100%; }
  .sns-topic-toolbar { grid-template-columns: 1fr 1fr; }
  .sns-topic-toolbar .button { grid-column: 1 / -1; width: 100%; }
  .choice-cards.four { grid-template-columns: 1fr 1fr; }
  .draft-source { grid-template-columns: 1fr; }
  .direct-flow { grid-template-columns: 1fr; }
  .social-compose-grid { grid-template-columns: 1fr; }
  .social-review-posts { grid-template-columns: 1fr; }
  .sns-login-panel { align-items: flex-start; flex-direction: column; }
  .sns-login-actions { width: 100%; }
  .sns-login-button { flex: 1 1 0; }
  .preview-fields { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-header { min-height: 64px; padding: 10px 16px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-block .eyebrow { display: none; }
  .brand-block h1 { font-size: 18px; }
  .header-status { max-width: 130px; font-size: 12px; text-align: right; }
  .header-actions { gap: 7px; }
  #open-setup { max-width: 84px; overflow: hidden; font-size: 11px; white-space: nowrap; }
  .app-shell { width: min(100% - 24px, 1180px); margin-top: 16px; }
  .hero-panel { padding: 28px 22px; border-radius: 22px; }
  .hero-panel h2 { font-size: 38px; }
  .hero-copy { font-size: 15px; }
  .auto-card { min-height: 96px; padding: 17px; }
  .auto-card-actions { align-items: flex-end; flex-direction: column-reverse; }
  .panel { padding: 20px 16px; border-radius: 20px; }
  .panel-heading { grid-template-columns: auto 1fr; align-items: start; margin-bottom: 22px; }
  .panel-heading .button, .panel-heading > .badge { grid-column: 1 / -1; width: 100%; }
  .panel-heading h2 { font-size: 23px; }
  .step-number { width: 42px; height: 42px; border-radius: 13px; }
  .account-grid, .topic-grid, .sns-topic-grid, .settings-grid, .choice-cards.two, .choice-cards.three, .choice-cards.four, .sns-source-list { grid-template-columns: 1fr; }
  .topic-toolbar, .sns-topic-toolbar { grid-template-columns: 1fr; }
  .segmented-field { grid-column: auto; grid-row: auto; }
  .segmented { grid-template-columns: 1fr 1fr; }
  .topic-toolbar .button { width: 100%; }
  .sns-topic-toolbar .button { grid-column: auto; }
  .empty-state { padding: 20px; }
  .sns-login-actions { flex-direction: column; }
  .sns-login-button { width: 100%; }
  .custom-topic { grid-template-columns: 1fr; gap: 7px; }
  .settings-section.span-two { grid-column: auto; }
  .model-picker-control { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .dialog-actions { grid-template-columns: 1fr; }
  .setup-blog-list { grid-template-columns: 1fr; }
  #setup-dialog { max-height: calc(100dvh - 24px); overflow: auto; }
  #preview-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  #social-review-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .social-review-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .social-topic-field .field-label-row { align-items: stretch; flex-direction: column; }
  .social-topic-field .button { width: 100%; }
  .preview-dialog-card { max-height: calc(100dvh - 16px); padding: 20px 14px; }
  .preview-dialog-header { gap: 10px; }
  .preview-dialog-header #close-preview { flex: 0 0 64px; min-width: 64px; padding-inline: 10px; white-space: nowrap; }
  .preview-actions { grid-template-columns: 1fr 1fr; }
  .social-review-card .preview-actions { grid-template-columns: 1fr; }
  #publish-preview { grid-column: 1 / -1; }
  .draft-list { grid-template-columns: 1fr; }
  .job-progress-status { align-items: flex-start; flex-direction: column; gap: 4px; }
  .job-actions .button { width: 100%; }
  #schedule-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); overflow: auto; }
  .schedule-card-heading { align-items: stretch; flex-direction: column; }
  .schedule-count-field { justify-content: space-between; }
  .schedule-time-list { grid-template-columns: 1fr 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root { --background: #0f0f12; --surface: #18181d; --surface-soft: #202026; --foreground: #f5f5f7; --muted-foreground: #aaaab4; --border: #35353d; --border-strong: #50505b; --primary: #f5f5f7; --primary-foreground: #151519; --accent-soft: #3b1725; --success-soft: #143326; --warning-soft: #3a2b12; --danger-soft: #3d171b; --shadow: 0 14px 40px rgba(0, 0, 0, .24); }
  html { color-scheme: dark; }
  .app-header { background: rgba(15, 15, 18, .88); }
  .brand-mark { color: #111; background: #fff; }
  .hero-panel { background: radial-gradient(circle at 84% 18%, rgba(231, 57, 120, .28), transparent 34%), #17171b; }
  .empty-state { background: #1c1c21; }
  .button-primary { color: #151519; background: #f5f5f7; }
  .button-primary:hover { background: #dedee4; }
  .segmented label:has(input:checked) span { color: #111; background: #fff; }
  .choice-card:has(input:checked) { border-color: #f5f5f7; box-shadow: 0 0 0 1px #f5f5f7; }
  .form-footer { color: #a7a7b1; background: #0f0f12; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
