:root {
    --bg: #f5efe4;
    --panel: rgba(255, 250, 243, 0.9);
    --panel-strong: #fffdf8;
    --text: #1f1a16;
    --muted: #6e6258;
    --accent: #bd5d38;
    --accent-strong: #8c3d22;
    --accent-soft: #efd1c4;
    --line: rgba(78, 50, 31, 0.12);
    --danger: #8d2f24;
    --success: #236a45;
    --shadow: 0 16px 40px rgba(70, 41, 20, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(189, 93, 56, 0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(110, 162, 141, 0.14), transparent 26%),
        linear-gradient(180deg, #fbf6ef 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

.page {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.page.login-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.frontend-shell-hidden {
    display: none;
}

.frontend-topbar {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding-top: 18px;
}

.frontend-topbar-card,
.hero,
.panel {
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 248, 240, 0.95), rgba(255, 255, 255, 0.82));
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px);
}

.frontend-topbar-card {
    padding: 20px 22px 18px;
}

.frontend-topbar-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.frontend-brand {
    display: grid;
    gap: 6px;
}

.frontend-brand-kicker {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.frontend-brand-title {
    margin: 0;
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.05;
}

.frontend-brand-subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.frontend-auth {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.frontend-auth-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.frontend-user-chip,
.hero-chip,
.layout-chip,
.meta-chip,
.group-chip,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(189, 93, 56, 0.1);
    color: var(--accent-strong);
    font-size: 12px;
    line-height: 1.3;
}

.group-chip-with-action {
    max-width: 100%;
    padding-right: 7px;
}

.group-chip-text {
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.frontend-user-chip {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1;
    min-height: 40px;
}

.frontend-auth-form,
.hero-tool-form,
.hero-form,
.layout-card-action-form,
.hero-button-form,
.asset-remove-form {
    margin: 0;
}

.frontend-auth-form,
.hero-button-form,
.layout-card-action-form {
    display: inline-flex;
    min-width: 0;
}

.hero-actions > * {
    flex: 0 0 auto;
}

.frontend-auth-link,
.frontend-auth-button,
.frontend-tab,
.hero-tool-link,
.hero-link,
.hero-button,
.content-tool-link,
.article-link,
.layout-card-action,
.audio-play-button,
.asset-remove-button,
.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 0;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.context-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.context-action-form {
    margin: 0;
    display: inline-flex;
    min-width: 0;
}

.context-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.context-action:hover {
    transform: translateY(-1px);
}

.context-action-edit {
    background: #2f5f9a;
    color: #fff;
}

.context-action-manuscript {
    background: #2f7d4f;
    color: #fff;
}

.context-action-video {
    background: #b8642b;
    color: #fff;
}

.context-action-download {
    background: #355f5a;
    color: #fff;
}

.context-action-copy {
    background: #6a4f2c;
    color: #fff;
}

.context-action-cover {
    background: #355c6d;
    color: #fff;
}

.context-action-cover-video {
    background: #5a3f8c;
    color: #fff;
}

.context-action-view {
    background: #efe1d4;
    color: var(--text);
    border-color: rgba(78, 50, 31, 0.14);
    box-shadow: none;
}

.frontend-auth-link,
.frontend-auth-button,
.hero-tool-link,
.hero-link,
.hero-button,
.content-tool-link,
.article-link,
.layout-card-action,
.audio-play-button,
.submit-button {
    background: var(--text);
    color: #fff;
}

.frontend-auth-link:hover,
.frontend-auth-button:hover,
.frontend-tab:hover,
.hero-tool-link:hover,
.hero-link:hover,
.hero-button:hover,
.content-tool-link:hover,
.article-link:hover,
.layout-card-action:hover,
.audio-play-button:hover,
.asset-remove-button:hover,
.submit-button:hover {
    transform: translateY(-1px);
}

.frontend-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.frontend-search {
    margin-top: 14px;
}

.frontend-search-label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
}

.frontend-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.frontend-search-input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
}

.frontend-search-input:focus {
    outline: 2px solid rgba(189, 93, 56, 0.18);
    border-color: rgba(189, 93, 56, 0.35);
}

.frontend-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 0;
    background: var(--accent-strong);
    color: #fff;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.frontend-search-button:hover {
    transform: translateY(-1px);
}

.frontend-tab {
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    border: 1px solid var(--line);
}

.frontend-tab.is-active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.hero {
    padding: 28px;
    margin-bottom: 18px;
}

.hero h1 {
    margin: 0 0 10px;
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
}

.hero p {
    margin: 0;
    color: var(--muted);
    max-width: 820px;
    line-height: 1.75;
}

.hero-meta,
.hero-tools,
.hero-actions,
.content-tools,
.article-meta,
.layout-meta,
.group-meta,
.merged-video-meta,
.audio-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-meta,
.hero-tools,
.hero-actions {
    margin-top: 16px;
}

.panel {
    padding: 22px;
}

.layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    margin-top: 22px;
}

.sidebar {
    position: sticky;
    top: 18px;
    height: fit-content;
}

.section-title {
    margin: 0;
    font-size: 15px;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.category-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.category-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    cursor: pointer;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.category-link:hover,
.category-link.active {
    transform: translateY(-1px);
    border-color: rgba(189, 93, 56, 0.35);
    background: #fffaf3;
}

.category-link strong {
    font-size: 16px;
}

.category-link-label {
    min-width: 0;
    flex: 1;
}

.category-link span {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 13px;
}

.content-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.content-header h2,
.layout-card h2,
.group-card h2,
.login-card h1 {
    margin: 0 0 10px;
    font-family: "Noto Serif SC", "Songti SC", serif;
    line-height: 1.2;
}

.content-header h2 {
    font-size: clamp(22px, 3vw, 32px);
}

.content-header p,
.layout-card-copy,
.board-note,
.empty-state,
.login-card p,
.hint {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0 20px;
}

.article-bulk-actions {
    margin: 0 0 18px;
}

.context-action-bulk-all {
    background: #8b3d2c;
    color: #fff;
}

.context-action-bulk-stale {
    background: #8f6a2e;
    color: #fff;
}

.article-list-messages {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.article-list-message {
    padding: 12px 16px;
    border-radius: 18px;
    border: 1px solid rgba(35, 106, 69, 0.18);
    background: rgba(35, 106, 69, 0.1);
    color: var(--success);
    line-height: 1.7;
}

.filter-link,
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    font-size: 14px;
}

.filter-link.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.filter-link-count {
    margin-left: 6px;
    opacity: 0.78;
    font-size: 12px;
}

.article-list,
.layout-list,
.group-list {
    display: grid;
    gap: 14px;
}

.article-card,
.layout-card,
.group-card {
    padding: 20px;
    border-radius: 22px;
    background: var(--panel-strong);
    border: 1px solid rgba(84, 55, 37, 0.08);
    min-width: 0;
}

.group-card {
    border-color: rgba(31, 26, 22, 0.85);
}

.article-top,
.article-footer,
.toolbar,
.layout-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.article-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.article-id,
.layout-meta,
.group-meta,
.task-summary,
.task-current,
.task-error,
.task-steps,
.asset-meta,
.asset-path,
.group-text,
.spoken-text,
.subtitle-live-label,
.subtitle-live-text,
.merged-video-meta,
.article-footer .muted {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-id,
.layout-meta,
.group-meta,
.task-summary,
.task-current,
.task-error,
.task-steps,
.asset-meta,
.asset-path,
.merged-video-meta,
.article-footer .muted {
    color: var(--muted);
}

.article-title,
.layout-card h2,
.group-card h2 {
    font-size: clamp(20px, 2.6vw, 28px);
}

.article-title {
    margin: 0 0 12px;
    line-height: 1.35;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-title-link,
.layout-card-title-link {
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-title-link:hover,
.layout-card-title-link:hover,
.group-chip-link:hover {
    color: var(--accent-strong);
}

.article-card p,
.group-text,
.spoken-text,
.asset-path,
.subtitle-live-text {
    margin: 0;
    line-height: 1.8;
    color: #43372f;
}

.article-card p {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.article-summary-block {
    display: grid;
    gap: 10px;
}

.article-summary-toggle {
    justify-self: flex-start;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    cursor: pointer;
}

.article-summary {
    display: block;
}

.article-summary.is-collapsed {
    display: none;
}

.importance-form {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

.action-button {
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1;
    color: #fff;
}

.action-button-primary,
.action-button-toggle-true {
    background: var(--success);
}

.action-button-secondary,
.action-button-toggle-false,
.asset-remove-button {
    background: #8b3d2c;
    color: #fff;
}

.importance-state {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
}

.importance-true {
    color: var(--success);
    border-color: rgba(35, 106, 69, 0.24);
    background: rgba(35, 106, 69, 0.08);
}

.importance-false {
    color: #8b3d2c;
    border-color: rgba(139, 61, 44, 0.24);
    background: rgba(139, 61, 44, 0.08);
}

.is-hidden {
    display: none;
}

.action-button.is-active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.action-button.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.importance-error {
    color: #8b3d2c;
    font-size: 13px;
    width: 100%;
}

.empty-state {
    padding: 32px 18px;
    border-radius: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.6);
    border: 1px dashed rgba(84, 55, 37, 0.18);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.layout-card-main {
    display: block;
    text-decoration: none;
}

.layout-generated-copy {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f6eadc;
    border: 1px solid #e6cfb4;
}

.layout-generated-copy-hero {
    margin-top: 16px;
}

.layout-cover-card {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(42, 79, 97, 0.08);
    border: 1px solid rgba(42, 79, 97, 0.18);
}

.layout-cover-card-hero {
    margin-top: 18px;
}

.layout-cover-preview {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    margin-top: 10px;
    background: rgba(31, 26, 22, 0.08);
}

.layout-generated-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #2c1d12;
}

.layout-generated-description {
    margin: 10px 0 0;
    color: #5a4738;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.copy-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.layout-list > .layout-card {
    width: 100%;
}

.layout-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
    min-width: 0;
}

.layout-card-action-secondary {
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    border: 1px solid var(--line);
}

.task-panel,
.merged-video-card,
.spoken-card,
.subtitle-live,
.asset-list li {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(31, 26, 22, 0.1);
}

.task-panel,
.merged-video-card {
    background: rgba(31, 26, 22, 0.04);
}

.spoken-card {
    background: rgba(110, 162, 141, 0.08);
}

.subtitle-live {
    background: rgba(31, 26, 22, 0.06);
}

.asset-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 16px;
}

.asset-list li {
    background: rgba(239, 209, 196, 0.14);
    transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.asset-list li.is-removing {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    filter: blur(2px);
}

.download-root-path {
    margin-top: 12px;
}

.download-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.download-entry-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.download-entry-meta {
    margin: 0;
}

.download-entry-link {
    color: var(--text);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.download-entry-link:hover {
    color: var(--accent-strong);
}

.download-entry-link.is-directory {
    color: #1f5f4b;
}

.download-entry-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.manuscript-group-assets {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.manuscript-group-assets.is-updating,
.manuscript-group-assets.is-entering {
    opacity: 0;
    transform: translateY(8px);
}

.asset-section-header {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.asset-upload-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.asset-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #355c6d;
    color: #fff;
    cursor: pointer;
}

.asset-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.asset-upload-status {
    min-height: 20px;
    font-size: 13px;
    color: var(--muted);
}

.asset-upload-status.is-error {
    color: var(--danger);
}

.asset-action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}

.asset-cover-button {
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #355c6d;
    color: #fff;
}

.asset-cover-button.is-selected {
    background: #2f6b43;
}

.asset-cover-status {
    min-height: 20px;
    font-size: 13px;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.asset-cover-status.is-visible {
    opacity: 1;
}

.task-summary,
.task-current,
.task-error {
    font-size: 14px;
    line-height: 1.7;
}

.task-summary strong,
.task-current strong,
.task-error strong {
    color: var(--text);
}

.task-error,
.error-list {
    color: var(--danger);
}

.task-steps {
    margin: 10px 0 0;
    padding-left: 18px;
    font-size: 13px;
}

.task-step-pending { color: var(--muted); }
.task-step-running { color: #9a5b19; }
.task-step-completed { color: #2f6b43; }
.task-step-failed { color: var(--danger); }

.merged-video-card h3,
.spoken-card h3,
.asset-section-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-family: "Noto Serif SC", "Songti SC", serif;
}

.spoken-card {
    margin-top: 16px;
}

.asset-details {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(84, 55, 37, 0.12);
    background: rgba(255, 255, 255, 0.48);
}

.asset-details-summary {
    cursor: pointer;
    color: var(--accent-strong);
    font-weight: 600;
    list-style: none;
}

.asset-details-summary::-webkit-details-marker {
    display: none;
}

.asset-details-summary::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    margin-right: 8px;
}

.asset-details[open] .asset-details-summary::before {
    content: "-";
}

.asset-details .asset-path,
.asset-details .asset-meta {
    margin-top: 12px;
}

.merged-video-player,
.video-player {
    width: 100%;
    border-radius: 14px;
    background: #000;
}

.media-player-wrap {
    margin-top: 12px;
}

.audio-player {
    width: min(100%, 420px);
}

.video-player {
    width: min(100%, 420px);
}

.toolbar {
    margin-bottom: 18px;
}

.save-button {
    padding: 11px 16px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    background: var(--text);
    color: #fff;
    font-size: 14px;
}

.editor-save-toolbar {
    margin-top: 18px;
    margin-bottom: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.editor-save-note {
    margin: 0;
    text-align: center;
}

.editor-save-button {
    min-width: 180px;
    min-height: 48px;
    width: min(100%, 220px);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 12px 26px rgba(31, 26, 22, 0.16);
}

.save-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(35, 106, 69, 0.08);
    color: var(--success);
    border: 1px solid rgba(35, 106, 69, 0.14);
}

.board-note-strong {
    color: var(--accent-strong);
}

.layout-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layout-row {
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(31, 26, 22, 0.85);
}

.layout-row-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(31, 26, 22, 0.5);
}

.layout-row-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(189, 93, 56, 0.12);
    color: var(--accent-strong);
    font-size: 12px;
}

.layout-row-tip {
    color: var(--muted);
    font-size: 12px;
}

.layout-row-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 86px;
}

.layout-row-cards > .layout-card,
.drag-placeholder {
    width: min(100%, 260px);
    padding: 16px;
    border-radius: 18px;
    box-shadow: 0 10px 26px rgba(70, 41, 20, 0.06);
}

.layout-row-cards > .layout-card {
    user-select: none;
}

.layout-row-cards > .layout-card.drag-enabled {
    cursor: grab;
    touch-action: none;
}

.layout-row-cards > .layout-card.drag-disabled {
    cursor: default;
}

.layout-row-cards > .layout-card:active {
    cursor: grabbing;
}

.layout-row-cards > .layout-card.drag-disabled:active {
    cursor: default;
}

.layout-card-title {
    margin: 0 0 10px;
    font-size: 17px;
    line-height: 1.45;
}

.layout-card-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 12px;
}

.layout-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 8px;
    border-radius: 12px;
    border: 1px solid rgba(84, 55, 37, 0.12);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
}

.layout-action-icon {
    font-size: 13px;
    line-height: 1;
}

.layout-action-label-short {
    display: none;
}

.layout-action-button:hover {
    border-color: rgba(189, 93, 56, 0.28);
    background: rgba(255, 248, 240, 0.96);
}

.layout-action-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    border-color: rgba(84, 55, 37, 0.08);
    background: rgba(255, 255, 255, 0.5);
    color: var(--muted);
}

.layout-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.layout-dropzone {
    height: 24px;
    border-radius: 999px;
    border: 1px dashed rgba(84, 55, 37, 0.16);
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.layout-dropzone.is-active {
    background: rgba(189, 93, 56, 0.08);
    border-color: rgba(189, 93, 56, 0.4);
}

.drag-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    border-style: dashed;
    background: rgba(255, 255, 255, 0.35);
}

.dragging-card {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    margin: 0;
    box-shadow: 0 18px 42px rgba(70, 41, 20, 0.18);
    transform: rotate(1.5deg);
}

.group-chip-link {
    text-decoration: none;
}

.group-chip-copy {
    min-height: 24px;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1;
}

.group-original-text {
    margin: 14px 0 0;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(84, 55, 37, 0.12);
    background: rgba(255, 255, 255, 0.52);
}

.group-original-summary {
    cursor: pointer;
    color: var(--accent-strong);
    font-weight: 600;
    list-style: none;
}

.group-original-summary::-webkit-details-marker {
    display: none;
}

.group-original-summary::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    margin-right: 8px;
}

.group-original-text[open] .group-original-summary::before {
    content: "-";
}

.group-original-text .group-text {
    margin-top: 12px;
}

.subtitle-actions {
    margin-top: 14px;
}

.subtitle-live-text {
    min-height: 28px;
    font-size: 18px;
    white-space: pre-wrap;
}

.asset-preview {
    display: block;
    width: auto;
    max-width: min(100%, 560px);
    max-height: 360px;
    margin-bottom: 12px;
    border-radius: 14px;
    border: 1px solid rgba(31, 26, 22, 0.12);
    background: rgba(255, 255, 255, 0.85);
    object-fit: contain;
}

.asset-meta {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    font-size: 14px;
}

.group-card .asset-section-title {
    margin-top: 0;
}

.image-asset-details {
    margin-bottom: 12px;
}

.empty-state-emphasis {
    margin-top: 14px;
    border-style: dashed;
    border-width: 2px;
    background: rgba(189, 93, 56, 0.08);
    color: var(--accent-strong);
}

.login-card {
    width: min(100%, 460px);
    padding: 30px;
    border-radius: 28px;
    background: rgba(255, 250, 243, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 24px 48px rgba(70, 41, 20, 0.1);
    backdrop-filter: blur(18px);
}

.login-card h1 {
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.1;
}

.login-form {
    margin-top: 24px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-size: 16px;
}

.login-card input:focus {
    outline: 2px solid rgba(189, 93, 56, 0.18);
    border-color: rgba(189, 93, 56, 0.4);
}

.error-list {
    margin: 0 0 16px;
    padding: 12px 14px;
    list-style: none;
    border-radius: 16px;
    background: rgba(141, 47, 36, 0.08);
    border: 1px solid rgba(141, 47, 36, 0.16);
    line-height: 1.7;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .category-toggle {
        display: inline-flex;
    }

    .category-list.is-collapsed .category-link-extra {
        display: none;
    }

    .category-list {
        gap: 8px;
    }

    .category-link {
        min-width: 0;
        padding: 12px 10px;
    }
}

@media (max-width: 768px) {
    .page,
    .frontend-topbar {
        width: min(100% - 16px, 1180px);
        padding-top: 16px;
    }

    .frontend-topbar-card,
    .hero,
    .panel,
    .group-card,
    .login-card {
        padding: 18px;
        border-radius: 20px;
    }

    .article-top,
    .article-footer,
    .content-header,
    .toolbar,
    .layout-row-header {
        align-items: flex-start;
    }

    .editor-save-toolbar {
        align-items: center;
        text-align: center;
    }

    .editor-save-button {
        width: min(100%, 200px);
    }

    .frontend-topbar-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 12px;
    }

    .frontend-auth {
        justify-content: flex-end;
        align-self: start;
        flex-wrap: wrap;
    }

    .frontend-search-row {
        gap: 8px;
    }

    .frontend-auth-group {
        gap: 8px;
        flex-wrap: wrap;
    }

    .frontend-user-chip {
        max-width: 136px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .frontend-brand-subtitle {
        display: none;
    }

    .article-card,
    .layout-card,
    .group-card {
        padding: 16px;
        border-radius: 18px;
    }

    .layout-row {
        padding: 8px;
        border-radius: 18px;
    }

    .layout-row-cards {
        gap: 8px;
    }

    .layout-row-cards > .layout-card,
    .drag-placeholder {
        width: 100%;
        padding: 14px;
    }

    .layout-card-controls {
        gap: 5px;
    }

    .layout-action-button {
        min-height: 38px;
        padding: 6px;
    }

    .layout-action-label-full {
        display: none;
    }

    .layout-action-label-short {
        display: inline;
    }
}

@media (max-width: 640px) {
    .frontend-tabs,
    .filter-bar,
    .hero-meta,
    .hero-tools,
    .hero-actions,
    .article-meta,
    .layout-meta,
    .group-meta,
    .audio-actions,
    .merged-video-meta {
        gap: 8px;
    }

    .frontend-tabs,
    .filter-bar,
    .hero-actions,
    .context-actions,
    .article-actions,
    .importance-form,
    .layout-card-actions {
        gap: 6px;
        flex-wrap: wrap;
        min-width: 0;
        max-width: 100%;
    }

    .filter-link,
    .pagination a,
    .pagination span,
    .hero-tool-link,
    .hero-link,
    .hero-button,
    .content-tool-link,
    .audio-play-button,
    .asset-remove-button,
    .submit-button,
    .action-button {
        width: 100%;
    }

    .frontend-tab,
    .frontend-auth-link,
    .frontend-auth-button,
    .hero-link,
    .hero-button,
    .context-action,
    .frontend-search-button,
    .filter-link,
    .article-link,
    .layout-card-action,
    .importance-state,
    .action-button {
        width: auto;
        max-width: 100%;
        flex: 0 1 auto;
        white-space: nowrap;
        padding: 8px 11px;
        font-size: 13px;
    }

    .frontend-auth {
        gap: 6px;
    }

    .frontend-user-chip {
        max-width: 110px;
        padding: 8px 11px;
        min-height: 36px;
        font-size: 13px;
    }

    .frontend-auth-link,
    .frontend-auth-button {
        min-height: 36px;
    }

    .article-footer {
        gap: 10px;
    }

    .article-actions,
    .layout-card-actions,
    .hero-actions,
    .context-actions,
    .importance-form {
        width: 100%;
    }

    .frontend-search-input,
    .frontend-search-button {
        width: 100%;
    }

    .layout-card-action-form,
    .hero-button-form,
    .context-action-form {
        min-width: 0;
        flex: 0 0 auto;
    }


    .frontend-search-row {
        flex-wrap: nowrap;
        align-items: center;
    }

    .frontend-search-input {
        flex: 1 1 auto;
    }

    .frontend-search-button {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .hero-link,
    .hero-button,
    .context-action {
        min-height: 36px;
    }

    .layout-card-controls {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
