:root {
  --ink: #151513;
  --ink-soft: #464640;
  --paper: #f6f4ef;
  --surface: #fffefa;
  --surface-soft: #efede7;
  --rule: #d4d0c7;
  --rule-strong: #97938a;
  --coral: #f45136;
  --coral-dark: #cf351f;
  --blue: #145eea;
  --green: #0a8f5b;
  --amber: #c77800;
  --red: #bf2c2c;
  --sidebar: 254px;
  --radius: 14px;
  --shadow: 0 16px 50px rgba(23, 23, 20, .08);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  line-height: 1.5;
  background: var(--paper);
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(20, 94, 234, .35); outline-offset: 3px; }
::selection { background: rgba(244, 81, 54, .22); }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-size: .92rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand b { font-weight: 500; color: var(--ink-soft); }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; background: var(--ink); color: var(--surface); font-size: 1rem; font-weight: 900; letter-spacing: -.08em; }
.eyebrow { margin: 0 0 12px; color: var(--coral-dark); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.text-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 24px; padding: 10px 17px; border: 1px solid var(--ink); border-radius: 7px; background: transparent; color: var(--ink); font-weight: 750; line-height: 1.2; text-decoration: none; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .56; }
.button.primary { border-color: var(--coral); background: var(--coral); color: #fff; }
.button.primary:hover:not(:disabled) { border-color: var(--coral-dark); background: var(--coral-dark); }
.button.secondary { border-color: var(--rule-strong); background: var(--surface); }
.button.ghost { border-color: transparent; background: transparent; color: var(--blue); }
.button.danger { border-color: var(--red); color: var(--red); }
.button.small { min-height: 38px; padding: 8px 14px; font-size: .86rem; }
.button.wide { width: 100%; justify-content: space-between; padding-inline: 20px; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--rule-strong); }
.status-dot.success { background: var(--green); }
.status-dot.warning { background: var(--amber); }
.status-dot.danger { background: var(--red); }
.status-dot.info { background: var(--blue); }

/* Public landing */
.public-header { display: flex; width: min(1480px, calc(100% - 48px)); min-height: 76px; align-items: center; justify-content: space-between; margin: 0 auto; border-bottom: 1px solid var(--ink); }
.public-nav { display: flex; align-items: center; gap: clamp(20px, 3vw, 46px); }
.public-nav > a:not(.button) { color: var(--ink-soft); font-size: .87rem; font-weight: 650; text-decoration: none; }
.public-nav > a:not(.button):hover { color: var(--coral); }
.landing-page main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(550px, 1.15fr); gap: clamp(50px, 7vw, 120px); align-items: center; min-height: 690px; padding: 82px 20px 78px; border-bottom: 1px solid var(--ink); }
.hero-copy h1 { max-width: 650px; margin: 0; font-family: "Iowan Old Style", "Songti TC", "Noto Serif TC", Georgia, serif; font-size: clamp(3.2rem, 5.2vw, 5.6rem); font-weight: 650; letter-spacing: -.055em; line-height: 1.08; }
.hero-lede { max-width: 590px; margin: 30px 0; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.85; }
.hero-actions { display: flex; align-items: center; gap: 28px; margin-bottom: 42px; }
.privacy-points { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.privacy-points li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; }
.privacy-points b, .privacy-points small { display: block; }
.privacy-points b { color: var(--blue); font-size: .91rem; }
.privacy-points small { margin-top: 3px; color: var(--ink-soft); }
.line-icon { color: var(--blue); font-size: 1.55rem; line-height: 1; }
.film-frame { overflow: hidden; border: 2px solid var(--ink); border-radius: 12px; background: var(--ink); box-shadow: var(--shadow); }
.film-edge { display: flex; height: 42px; align-items: center; justify-content: space-around; padding: 0 8px; }
.film-edge i { width: 21px; height: 21px; border-radius: 3px; background: var(--paper); }
.film-body { padding: clamp(28px, 4vw, 56px); background: var(--surface); }
.film-meta { display: flex; justify-content: space-between; margin: -20px 0 26px; font-size: .7rem; font-weight: 800; letter-spacing: .1em; }
.film-body label > span { display: block; margin-bottom: 9px; font-size: .84rem; font-weight: 750; }
.film-body textarea { width: 100%; min-height: 200px; padding: 22px; resize: none; border: 1px solid var(--ink); border-radius: 6px; background: transparent; color: #74736e; line-height: 2; }
.film-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.film-actions small { color: var(--ink-soft); }
.workflow, .platform-section { display: grid; grid-template-columns: 210px 1fr; border-bottom: 1px solid var(--ink); }
.section-label { padding: 38px 24px 38px 0; border-right: 1px solid var(--rule); }
.section-label h2 { margin: 0; font-family: "Iowan Old Style", "Songti TC", serif; font-size: 1.7rem; line-height: 1.25; }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; list-style: none; }
.step-grid li { min-height: 205px; padding: 38px; border-right: 1px solid var(--rule); }
.step-grid li:last-child { border-right: 0; }
.step-grid li > span { color: var(--coral); font-size: .76rem; font-weight: 850; }
.step-grid h3 { margin: 34px 0 10px; font-size: 1rem; }
.step-grid p { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.7; }
.platform-section { grid-template-columns: 210px 1fr minmax(320px, .55fr); }
.platform-list { display: grid; grid-template-columns: repeat(3, 1fr); }
.platform-list article { display: flex; min-height: 230px; gap: 18px; align-items: center; padding: 38px; border-right: 1px solid var(--rule); }
.platform-list article > span { display: grid; width: 45px; height: 45px; flex: 0 0 45px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-size: .72rem; font-weight: 900; }
.platform-list h3 { margin: 0 0 8px; font-size: .95rem; }
.platform-list p { margin: 0; color: var(--ink-soft); font-size: .82rem; }
.platform-section aside { min-height: 230px; padding: 38px; }
.platform-section aside h2 { margin: 0; color: var(--blue); font-family: "Iowan Old Style", "Songti TC", serif; font-size: 1.45rem; }
.platform-section aside ul { display: grid; gap: 7px; margin: 20px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: .82rem; }
.landing-page footer { display: flex; width: min(1480px, calc(100% - 48px)); justify-content: space-between; margin: 0 auto; padding: 22px 0 44px; font-size: .73rem; }

/* Authentication */
.auth-page { min-height: 100vh; background: var(--surface); }
.auth-layout { display: grid; width: min(1180px, calc(100% - 48px)); grid-template-columns: 1fr 480px; gap: clamp(60px, 10vw, 160px); align-items: center; min-height: calc(100vh - 76px); margin: 0 auto; padding: 70px 0; }
.auth-intro h1 { margin: 0; font-family: "Iowan Old Style", "Songti TC", serif; font-size: clamp(3rem, 6vw, 5.2rem); letter-spacing: -.05em; line-height: 1.05; }
.auth-intro > p:not(.eyebrow) { max-width: 520px; margin: 28px 0 50px; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.8; }
.auth-intro ol { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid var(--rule); list-style: none; }
.auth-intro li { display: grid; grid-template-columns: 56px 1fr; padding: 15px 0; border-bottom: 1px solid var(--rule); font-size: .9rem; font-weight: 700; }
.auth-intro li span { color: var(--coral); }
.auth-panel { padding: clamp(28px, 4vw, 52px); border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.auth-panel-head { display: flex; gap: 9px; align-items: center; margin-bottom: 30px; color: var(--ink-soft); font-size: .76rem; font-weight: 700; }
.auth-form { display: grid; gap: 20px; }
.auth-form.compact { margin-top: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-form label, .form-field { display: grid; gap: 8px; color: var(--ink-soft); font-size: .82rem; font-weight: 700; }
.auth-form label span, .form-field > span { display: flex; justify-content: space-between; }
.auth-form label em { color: var(--rule-strong); font-size: .7rem; font-style: normal; font-weight: 500; }
.auth-form small { color: var(--rule-strong); font-weight: 500; }
.auth-switch { margin: 24px 0 0; color: var(--ink-soft); font-size: .85rem; text-align: center; }
.auth-switch a { margin-left: 7px; color: var(--blue); font-weight: 700; }
.form-error { margin: 0 0 22px; padding: 12px 14px; border-left: 3px solid var(--red); background: #fff0ed; color: var(--red); font-size: .83rem; }

/* Application shell */
.app-shell { min-height: 100vh; }
.app-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: var(--sidebar); flex-direction: column; padding: 24px 17px 20px; border-right: 1px solid var(--rule); background: var(--surface); }
.sidebar-brand { min-height: 52px; padding: 0 6px 21px; border-bottom: 1px solid var(--rule); }
.sidebar-brand > span:last-child { display: grid; }
.sidebar-brand b { font-size: .7rem; }
.app-sidebar nav { display: flex; flex-direction: column; gap: 5px; padding-top: 22px; }
.nav-item { display: grid; min-height: 43px; grid-template-columns: 24px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-left: 3px solid transparent; border-radius: 4px; color: var(--ink-soft); font-size: .85rem; font-weight: 650; text-decoration: none; }
.nav-item > span { color: var(--ink); font-size: 1.1rem; text-align: center; }
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item.active { border-left-color: var(--coral); background: #fff0ec; color: var(--coral-dark); }
.nav-item.active > span { color: var(--coral); }
.nav-label { margin: 25px 10px 8px; color: var(--rule-strong); font-size: .63rem; font-weight: 800; letter-spacing: .12em; }
.sidebar-footer { display: grid; gap: 5px; margin-top: auto; }
.nav-utility { padding: 8px 10px; border: 0; background: transparent; color: var(--ink-soft); font-size: .76rem; text-align: left; text-decoration: none; }
.nav-utility:hover { color: var(--blue); }
.user-chip { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; margin-top: 10px; padding: 15px 8px 0; border-top: 1px solid var(--rule); }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; background: var(--surface); font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.user-chip b, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip b { font-size: .78rem; }
.user-chip small { margin-top: 2px; color: var(--ink-soft); font-size: .67rem; }
.user-chip i { margin-right: 5px; }
.app-main { min-width: 0; min-height: 100vh; margin-left: var(--sidebar); }
.app-main > main { width: min(1320px, calc(100% - 64px)); margin: 0 auto; padding: 36px 0 80px; }
.mobile-app-header { display: none; }
.page-heading { display: flex; min-height: 86px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--ink); }
.page-heading h1 { margin: 0; font-family: "Iowan Old Style", "Songti TC", serif; font-size: clamp(2rem, 3.2vw, 3.4rem); font-weight: 650; letter-spacing: -.035em; line-height: 1; }
.system-state { display: flex; gap: 8px; align-items: center; padding-top: 8px; color: var(--ink-soft); font-size: .72rem; }
.toast { position: sticky; z-index: 20; top: 14px; margin: 16px 0; padding: 11px 14px; border: 1px solid var(--blue); border-radius: 7px; background: #eef4ff; color: #1148a5; font-size: .82rem; box-shadow: 0 10px 25px rgba(20, 94, 234, .08); }
.toast.success { border-color: var(--green); background: #edf8f2; color: #076c46; }
.toast.danger { border-color: var(--red); background: #fff0ed; color: #9c2424; }
.step-up-dialog { width: min(520px, calc(100% - 32px)); max-height: min(680px, calc(100dvh - 32px)); padding: 0; overflow: auto; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); box-shadow: 0 28px 90px rgba(21, 21, 19, .28); }
.step-up-dialog::backdrop { background: rgba(21, 21, 19, .48); backdrop-filter: blur(3px); }
.step-up-shell { overflow: hidden; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); }
.step-up-head { padding: 27px 29px 23px; border-bottom: 1px solid var(--rule); }
.step-up-head h2 { margin: 0; font-family: "Iowan Old Style", "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 1.55rem; letter-spacing: -.025em; }
.step-up-head p { margin: 10px 0 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.65; }
.step-up-form { display: grid; gap: 17px; padding: 25px 29px 29px; }
.step-up-error { margin: 0; padding: 11px 13px; border-left: 3px solid var(--red); background: #fff0ed; color: var(--red); font-size: .78rem; }
.step-up-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.loading-state { display: grid; min-height: 380px; place-items: center; align-content: center; color: var(--ink-soft); }
.loading-state span { width: 28px; height: 28px; border: 2px solid var(--rule); border-top-color: var(--coral); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Common content */
.content-stack { display: grid; min-width: 0; gap: 26px; padding-top: 28px; }
.content-stack > *, .admin-grid > *, .panel, .panel-body { min-width: 0; }
.panel { border-top: 1px solid var(--ink); background: transparent; }
.panel.surface { padding: 22px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 62px; }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: .77rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.subtle { color: var(--ink-soft); }
.empty-state { display: grid; min-height: 190px; place-items: center; align-content: center; padding: 30px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); color: var(--ink-soft); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); }
.empty-state span { font-size: 1.8rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); background: var(--surface); }
.metric { min-height: 118px; padding: 20px; border-right: 1px solid var(--rule); }
.metric:last-child { border-right: 0; }
.metric-label { display: flex; gap: 8px; align-items: center; color: var(--ink-soft); font-size: .75rem; }
.metric strong { display: block; margin-top: 16px; font-size: clamp(1.4rem, 2.4vw, 2rem); letter-spacing: -.04em; line-height: 1; }
.metric small { color: var(--ink-soft); }
.data-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.data-table th { padding: 11px 14px; border-bottom: 1px solid var(--ink); color: var(--ink-soft); font-size: .68rem; font-weight: 750; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #faf8f2; }
.cell-main { display: block; max-width: 320px; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { display: block; margin-top: 3px; color: var(--ink-soft); font-size: .7rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); color: var(--ink-soft); font-size: .68rem; font-weight: 700; white-space: nowrap; }
.badge.success { border-color: #9ccfb9; color: var(--green); }
.badge.warning { border-color: #e1bc7d; color: var(--amber); }
.badge.danger { border-color: #e2a5a5; color: var(--red); }
.badge.info { border-color: #aac3f5; color: var(--blue); }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: .75rem; font-weight: 750; }
.link-button.danger { color: var(--red); }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.definition-item { min-height: 82px; padding: 15px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.definition-item dt { color: var(--ink-soft); font-size: .7rem; }
.definition-item dd { margin: 8px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 7px; background: var(--surface); }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
textarea { min-height: 150px; resize: vertical; line-height: 1.7; }
.form-hint { color: var(--ink-soft); font-size: .7rem; font-weight: 500; }
.form-footer { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.secret-panel { padding: 16px; border: 1px solid var(--blue); border-radius: 8px; background: #eef4ff; }
.secret-panel p { margin: 0 0 10px; color: #1148a5; font-size: .76rem; }
.secret-value { display: flex; gap: 10px; align-items: center; }
.secret-value code { min-width: 0; flex: 1; overflow: hidden; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { overflow: hidden; height: 7px; border-radius: 8px; background: var(--surface-soft); }
.progress-track > span { display: block; width: var(--progress, 0%); height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }

/* Workspace */
.workspace-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 30px; }
.workspace-main { display: grid; min-width: 0; gap: 26px; }
.composer { overflow: hidden; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); }
.composer-top { display: flex; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); font-size: .72rem; }
.composer textarea { min-height: 190px; padding: 20px; border: 0; border-radius: 0; background: transparent; font-size: .95rem; outline: 0; }
.composer textarea:focus { box-shadow: inset 0 0 0 2px var(--blue); }
.composer-controls { display: grid; grid-template-columns: minmax(170px, 220px) 1fr auto; gap: 14px; align-items: end; padding: 16px 18px; border-top: 1px solid var(--rule); }
.composer-controls label { display: grid; gap: 5px; color: var(--ink-soft); font-size: .69rem; font-weight: 700; }
.input-counter { align-self: center; color: var(--ink-soft); font-size: .72rem; }
.task-panel { padding: 0; }
.task-summary { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--rule); }
.task-summary h2 { margin: 0 0 5px; font-size: 1rem; }
.task-meta { color: var(--ink-soft); font-size: .73rem; }
.task-progress { grid-column: 1 / -1; }
.task-progress-labels { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--ink-soft); font-size: .69rem; }
.result-list { display: grid; }
.media-result { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 17px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.media-result:last-child { border-bottom: 0; }
.media-thumb { position: relative; overflow: hidden; width: 110px; aspect-ratio: 16 / 10; border-radius: 7px; background: var(--surface-soft); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb span { position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; border-radius: 3px; background: rgba(21, 21, 19, .82); color: #fff; font-size: .62rem; }
.media-info { min-width: 0; }
.media-info h3 { overflow: hidden; margin: 0 0 5px; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.media-info p { margin: 0; color: var(--ink-soft); font-size: .72rem; }
.media-info .badge { margin-top: 9px; }
.media-actions { display: flex; gap: 7px; align-items: center; }
.recent-rail { min-width: 0; padding-left: 24px; border-left: 1px solid var(--rule); }
.recent-rail .panel-head { min-height: 47px; }
.history-list { display: grid; gap: 0; border-top: 1px solid var(--ink); }
.history-item { display: grid; width: 100%; grid-template-columns: 1fr auto; gap: 9px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; }
.history-item:hover { color: var(--blue); }
.history-item strong { display: block; overflow: hidden; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { color: var(--ink-soft); font-size: .66rem; }
.history-item .status-dot { margin-top: 5px; }

/* Account and admin */
.profile-strip { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--ink); }
.profile-strip .avatar { width: 58px; height: 58px; font-size: 1.2rem; }
.profile-strip h2 { margin: 0; font-size: 1.2rem; }
.profile-strip p { margin: 4px 0 0; color: var(--ink-soft); font-size: .78rem; }
.usage-list { display: grid; gap: 20px; }
.usage-row { display: grid; grid-template-columns: 170px 1fr 110px; gap: 18px; align-items: center; }
.usage-row label { font-size: .8rem; font-weight: 700; }
.usage-row output { color: var(--ink-soft); font-size: .72rem; text-align: right; }
.admin-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
.credential-list { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.credential-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 15px; border-bottom: 1px solid var(--rule); }
.credential-row:last-child { border-bottom: 0; }
.platform-icon { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--ink); border-radius: 8px; font-size: .68rem; font-weight: 900; }
.credential-row h3 { margin: 0; font-size: .85rem; text-transform: capitalize; }
.credential-row p { margin: 3px 0 0; color: var(--ink-soft); font-size: .69rem; }
.qr-login-stage { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--ink); border-radius: 10px; background: var(--paper); }
.qr-login-visual { display: grid; min-height: 280px; place-items: center; padding: 20px; border-right: 1px solid var(--ink); background: #fff; }
.qr-login-visual img { display: block; width: min(100%, 240px); height: auto; image-rendering: pixelated; }
.qr-login-placeholder { display: grid; max-width: 190px; place-items: center; gap: 7px; color: var(--ink-soft); text-align: center; }
.qr-login-placeholder > span { display: grid; width: 58px; height: 58px; place-items: center; margin-bottom: 5px; border: 1px solid var(--ink); border-radius: 12px; color: var(--ink); font-size: .86rem; font-weight: 900; }
.qr-login-placeholder strong { color: var(--ink); font-size: .85rem; }
.qr-login-placeholder small { font-size: .68rem; line-height: 1.55; }
.qr-login-copy { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: clamp(24px, 4vw, 48px); }
.qr-login-copy h3 { max-width: 620px; margin: 0; font-family: "Iowan Old Style", "Songti TC", serif; font-size: clamp(1.35rem, 2vw, 2rem); letter-spacing: -.025em; line-height: 1.15; }
.qr-login-copy > p { max-width: 700px; margin: 16px 0 24px; color: var(--ink-soft); font-size: .77rem; line-height: 1.75; }
.qr-login-state { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; max-width: 700px; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: .74rem; }
.qr-login-state time { color: var(--ink-soft); font-size: .68rem; }
.qr-login-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.event-list { display: grid; border-top: 1px solid var(--ink); }
.event-row { position: relative; display: grid; grid-template-columns: 13px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.event-row::before { position: absolute; top: 25px; bottom: -14px; left: 4px; width: 1px; background: var(--rule); content: ""; }
.event-row:last-child::before { display: none; }
.event-row .status-dot { z-index: 1; margin-top: 5px; box-shadow: 0 0 0 3px var(--paper); }
.event-row strong { display: block; font-size: .77rem; }
.event-row p { margin: 3px 0 0; color: var(--ink-soft); font-size: .68rem; }
.event-row time { color: var(--ink-soft); font-size: .65rem; white-space: nowrap; }
.maintenance-box { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 18px; border: 1px solid #e5bd74; border-radius: 8px; background: #fff8e9; }
.maintenance-box h3 { margin: 0; font-size: .87rem; }
.maintenance-box p { margin: 4px 0 0; color: var(--ink-soft); font-size: .72rem; }
.quota-editor { margin-top: 12px; padding: 15px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.quota-editor summary { cursor: pointer; color: var(--blue); font-size: .75rem; font-weight: 750; }
.quota-editor .form-grid { margin-top: 15px; }

/* Result library and capacity policies */
.library-controls { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; align-items: end; padding: 18px; border: 1px solid var(--ink); border-radius: 10px; background: #fff; }
.library-controls .form-field:first-child { grid-column: 1 / -1; }
.library-controls .form-field { display: grid; gap: 6px; }
.library-controls .form-field > span { color: var(--ink-soft); font-size: .68rem; font-weight: 750; }
.library-summary { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.library-summary strong { font-family: "Iowan Old Style", "Songti TC", serif; font-size: 1.12rem; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 18px; }
.content-card { display: grid; min-width: 0; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid var(--rule); border-radius: 11px; background: #fff; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.content-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(21, 21, 19, .08); }
.content-card.is-clickable { cursor: pointer; }
.content-card.is-clickable:focus-visible { outline: 3px solid rgba(230, 83, 63, .32); outline-offset: 3px; border-color: var(--accent); }
.content-card-visual { position: relative; overflow: hidden; aspect-ratio: 16 / 10; border-bottom: 1px solid var(--rule); background: #e8e5dd; }
.content-card-visual img { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; }
.content-card-visual.cover-missing img { display: none; }
.cover-fallback { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; color: #777269; font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(2.3rem, 6vw, 4.6rem); font-weight: 700; letter-spacing: -.08em; }
.content-card-visual-meta { position: absolute; z-index: 3; right: 8px; bottom: 8px; left: 8px; display: flex; justify-content: space-between; color: #fff; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-shadow: 0 1px 4px rgba(0, 0, 0, .75); }
.content-card-visual.cover-missing .content-card-visual-meta { color: var(--ink); text-shadow: none; }
.content-card-body { display: flex; min-width: 0; min-height: 220px; flex-direction: column; padding: 16px; }
.content-card-flags { display: flex; min-height: 25px; align-items: center; justify-content: space-between; gap: 10px; }
.pin-label { color: var(--coral-dark); font-size: .67rem; font-weight: 800; }
.content-card h3 { display: -webkit-box; overflow: hidden; margin: 13px 0 5px; font-size: .96rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.content-card-author { overflow: hidden; margin: 0; color: var(--ink-soft); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.content-card-meta { display: flex; justify-content: space-between; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: .68rem; }
.content-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; padding-top: 17px; }
.content-card-actions .button { min-height: 34px; padding: 7px 11px; font-size: .72rem; }
.media-label { font-size: .65rem; font-weight: 800; letter-spacing: .05em; }
.media-label.live { color: #9f382b; }
.content-card.compact { grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: none; border-width: 0 0 1px; border-radius: 0; box-shadow: none; }
.content-card.compact:hover { transform: none; box-shadow: none; }
.content-card.compact .content-card-visual { width: 120px; align-self: center; border: 0; border-radius: 7px; }
.content-card.compact .content-card-body { display: grid; min-height: 0; grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px; padding: 16px 0 16px 18px; }
.content-card.compact .content-card-flags, .content-card.compact h3, .content-card.compact .content-card-author, .content-card.compact .content-card-meta { grid-column: 1; }
.content-card.compact .content-card-flags { justify-content: flex-start; }
.content-card.compact h3 { margin-top: 8px; }
.content-card.compact .content-card-meta { border: 0; margin: 5px 0 0; padding: 0; justify-content: flex-start; gap: 14px; }
.content-card.compact .content-card-actions { grid-column: 2; grid-row: 1 / 6; align-self: center; justify-content: flex-end; margin: 0; padding: 0; }
.error-guidance { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid #e3aaa2; }
.error-guidance-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #fff0ed; color: var(--red); font-weight: 900; }
.error-guidance h3 { margin: 0 0 4px; font-size: .88rem; }
.error-guidance p { margin: 0 0 5px; color: var(--ink-soft); font-size: .74rem; }
.error-guidance small { color: var(--red); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .64rem; }
.library-skeleton { aspect-ratio: 4 / 5; border: 1px solid var(--rule); border-radius: 11px; background: linear-gradient(90deg, #eeeae2 25%, #faf8f3 50%, #eeeae2 75%); background-size: 200% 100%; animation: skeleton 1.2s infinite linear; }
@keyframes skeleton { to { background-position: -200% 0; } }
.library-more { justify-self: center; }
.library-detail-page { max-width: 1120px; }
.detail-back { width: fit-content; color: var(--ink-soft); font-size: .78rem; font-weight: 750; text-decoration: none; }
.detail-back:hover { color: var(--accent); }
.library-detail-hero { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(360px, 1.1fr); overflow: hidden; border: 1px solid var(--ink); border-radius: 12px; background: #fff; }
.library-detail-visual { position: relative; min-height: 440px; overflow: hidden; border-right: 1px solid var(--ink); background: #e8e5dd; }
.library-detail-visual img { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; }
.library-detail-visual.cover-missing img { display: none; }
.library-detail-visual .cover-fallback { font-size: 4rem; }
.library-detail-copy { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 64px); }
.detail-flags { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.library-detail-copy h2 { margin: 24px 0 8px; font-family: "Iowan Old Style", "Songti TC", serif; font-size: clamp(1.8rem, 3.2vw, 3.2rem); line-height: 1.16; overflow-wrap: anywhere; }
.detail-author { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.detail-facts { display: grid; margin: 36px 0 0; border-top: 1px solid var(--rule); }
.detail-facts div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.detail-facts dt { color: var(--ink-soft); font-size: .68rem; font-weight: 750; }
.detail-facts dd { min-width: 0; margin: 0; font-size: .74rem; overflow-wrap: anywhere; }
.live-photo-note { display: grid; grid-template-columns: minmax(180px, .4fr) minmax(0, 1fr); gap: 30px; padding: 24px 28px; border-left: 4px solid var(--accent); background: #f7eee9; }
.live-photo-note strong { font-family: "Iowan Old Style", "Songti TC", serif; font-size: 1.15rem; }
.live-photo-note p { margin: 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.7; }
.detail-downloads, .detail-utilities { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.detail-utilities { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--rule); }

.capacity-rail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-block: 1px solid var(--ink); background: #fff; }
.capacity-rail .metric { min-height: 110px; }
.policy-list { border-top: 1px solid var(--ink); }
.policy-row { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) 110px; gap: 22px; align-items: center; min-height: 86px; padding: 14px 2px; border-bottom: 1px solid var(--rule); }
.policy-copy h3 { margin: 0; font-size: .87rem; }
.policy-copy p { margin: 4px 0 0; color: var(--ink-soft); font-size: .69rem; }
.policy-control { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: center; }
.policy-control input { border-radius: 6px 0 0 6px; background: #fff; }
.policy-control span { display: grid; min-height: 44px; place-items: center; border: 1px solid var(--rule-strong); border-left: 0; border-radius: 0 6px 6px 0; color: var(--ink-soft); font-size: .68rem; }
.policy-actions { text-align: right; }
.preview-impact { display: grid; gap: 16px; }
.impact-summary .metric { border: 1px solid var(--rule); background: #fff; }
.change-list { display: grid; gap: 5px; margin: 0; padding-left: 20px; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.capacity-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--rule); }

@media (max-width: 1180px) {
  :root { --sidebar: 220px; }
  .hero { grid-template-columns: 1fr 1.1fr; gap: 45px; }
  .platform-section { grid-template-columns: 180px 1fr; }
  .platform-section aside { grid-column: 1 / -1; border-top: 1px solid var(--rule); }
  .workspace-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-detail-hero { grid-template-columns: minmax(260px, .85fr) minmax(330px, 1.15fr); }
  .library-detail-visual { min-height: 380px; }
  .library-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .library-controls .form-field:first-child { grid-column: 1 / -1; }
  .capacity-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .public-nav a:not(.button) { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 60px; }
  .hero-copy h1 { font-size: clamp(3.1rem, 11vw, 5.2rem); }
  .film-frame { max-width: 680px; }
  .workflow, .platform-section { grid-template-columns: 1fr; }
  .section-label { border-right: 0; border-bottom: 1px solid var(--rule); }
  .platform-list { grid-template-columns: 1fr; }
  .platform-list article { min-height: 120px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .auth-layout { grid-template-columns: 1fr; max-width: 600px; }
  .auth-intro { display: none; }
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app-sidebar.open { transform: translateX(0); box-shadow: 24px 0 60px rgba(0, 0, 0, .18); }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: block; width: 100%; border: 0; background: rgba(21, 21, 19, .36); }
  .sidebar-backdrop[hidden] { display: none; }
  .app-main { margin-left: 0; }
  .mobile-app-header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--ink); background: var(--surface); }
  .app-main > main { width: min(100% - 38px, 760px); padding-top: 25px; }
  .workspace-layout { grid-template-columns: 1fr; }
  .recent-rail { padding: 0; border-left: 0; }
  .admin-grid { grid-template-columns: 1fr; }
  .policy-row { grid-template-columns: 1fr minmax(170px, 240px); }
  .policy-actions { grid-column: 1 / -1; text-align: left; }
}

@media (max-width: 640px) {
  .public-header, .landing-page main, .landing-page footer { width: calc(100% - 30px); }
  .public-header { min-height: 66px; }
  .public-header .brand b { display: none; }
  .public-nav { gap: 10px; }
  .public-nav .button { min-height: 36px; padding: 7px 10px; font-size: .75rem; }
  .hero { min-height: 0; gap: 38px; padding: 52px 4px 48px; }
  .hero-copy h1 { font-size: clamp(2.7rem, 13vw, 4rem); }
  .hero-lede { margin: 24px 0; font-size: .96rem; }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 15px; }
  .hero-actions .text-link { text-align: center; }
  .film-edge { height: 28px; }
  .film-edge i { width: 14px; height: 14px; }
  .film-body { padding: 26px 18px; }
  .film-body textarea { min-height: 160px; padding: 14px; font-size: .76rem; }
  .film-actions { align-items: stretch; flex-direction: column; }
  .step-grid { grid-template-columns: 1fr; }
  .step-grid li { display: grid; min-height: 0; grid-template-columns: 45px 1fr; padding: 25px 8px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .step-grid h3 { margin: 0 0 5px; }
  .step-grid p { grid-column: 2; }
  .platform-list article { padding: 25px 8px; }
  .platform-section aside { padding: 30px 8px; }
  .landing-page footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .auth-page .public-header { width: calc(100% - 30px); }
  .auth-layout { width: calc(100% - 30px); min-height: calc(100vh - 66px); padding: 28px 0; }
  .auth-panel { padding: 24px 18px; }
  .step-up-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .step-up-head { padding: 23px 20px 19px; }
  .step-up-form { padding: 21px 20px 23px; }
  .step-up-actions { align-items: stretch; flex-direction: column-reverse; }
  .step-up-actions .button { width: 100%; }
  .field-row, .form-grid { grid-template-columns: 1fr; }
  .form-field.full, .form-footer { grid-column: 1; }
  .app-main > main { width: calc(100% - 28px); padding-bottom: 45px; }
  .mobile-app-header { padding-inline: 14px; }
  .page-heading { min-height: 75px; }
  .page-heading .eyebrow { display: none; }
  .page-heading h1 { font-size: 2rem; }
  .system-state { padding-top: 4px; }
  .content-stack { gap: 22px; padding-top: 22px; }
  .panel.surface { padding: 16px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 100px; padding: 14px; }
  .metric strong { font-size: 1.35rem; }
  .composer-controls { grid-template-columns: 1fr; }
  .composer-controls .button { width: 100%; }
  .input-counter { order: -1; }
  .task-summary { grid-template-columns: 1fr; }
  .task-summary .badge { justify-self: start; }
  .media-result { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .media-thumb { width: 82px; }
  .media-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .profile-strip { grid-template-columns: auto 1fr; }
  .profile-strip > .badge { grid-column: 1 / -1; justify-self: start; }
  .usage-row { grid-template-columns: 1fr auto; gap: 8px; }
  .usage-row .progress-track { grid-column: 1 / -1; grid-row: 2; }
  .definition-grid { grid-template-columns: 1fr; }
  .maintenance-box { grid-template-columns: 1fr; }
  .data-table { min-width: 680px; }
  .credential-row { grid-template-columns: 42px minmax(0, 1fr); }
  .credential-row > .inline-actions, .credential-row > .badge { grid-column: 1 / -1; justify-self: start; }
  .qr-login-stage { grid-template-columns: 1fr; }
  .qr-login-visual { min-height: 250px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .qr-login-copy { padding: 24px 20px; }
  .qr-login-state { grid-template-columns: 10px 1fr; }
  .qr-login-state time { grid-column: 2; }
  .qr-login-actions { align-items: stretch; flex-direction: column; }
  .qr-login-actions .button { width: 100%; }
  .library-controls { grid-template-columns: 1fr 1fr; padding: 14px; }
  .library-controls .form-field:first-child { grid-column: 1 / -1; }
  .library-grid { grid-template-columns: 1fr; }
  .library-detail-hero { grid-template-columns: 1fr; }
  .library-detail-visual { min-height: 0; aspect-ratio: 4 / 3; border-right: 0; border-bottom: 1px solid var(--ink); }
  .library-detail-copy { padding: 24px 20px 28px; }
  .library-detail-copy h2 { margin-top: 18px; font-size: 1.8rem; }
  .detail-facts { margin-top: 24px; }
  .detail-facts div { grid-template-columns: 96px minmax(0, 1fr); }
  .live-photo-note { grid-template-columns: 1fr; gap: 10px; padding: 20px; }
  .detail-downloads .button, .detail-utilities .button { width: 100%; }
  .library-summary { align-items: flex-start; flex-direction: column; gap: 8px; }
  .content-card.compact { grid-template-columns: 88px minmax(0, 1fr); }
  .content-card.compact .content-card-visual { width: 88px; }
  .content-card.compact .content-card-body { display: flex; padding-left: 12px; }
  .content-card.compact .content-card-actions { justify-content: flex-start; margin-top: 12px; }
  .error-guidance { grid-template-columns: 30px 1fr; }
  .error-guidance .inline-actions { grid-column: 2; }
  .capacity-rail { grid-template-columns: 1fr 1fr; }
  .capacity-rail .metric:last-child { grid-column: 1 / -1; }
  .policy-row { grid-template-columns: 1fr; gap: 10px; padding-block: 18px; }
  .policy-actions { grid-column: 1; }
  .capacity-actions { align-items: stretch; flex-direction: column; }
}

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