:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #000000;
    --hover-bg: #f9fafb;
    --meta-color: #4b5563;
    --accent-light: #f3f4f6;
    --success-color: #059669;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 40px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 48px;
    padding-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.75px;
    text-transform: uppercase;
}

p.subtitle {
    color: var(--meta-color);
    font-size: 13px;
    letter-spacing: 0.5px;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 992px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    padding-bottom: 8px;
    color: var(--text-color);
}

.field {
    margin-bottom: 20px;
}

.row-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--meta-color);
}

input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--text-color);
    background-color: transparent;
    color: var(--text-color);
    font-size: 14px;
    border-radius: 0px;
    outline: none;
    font-variant-numeric: tabular-nums;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
    border-bottom-width: 2px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.actions-bar {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

button, .btn-link {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: 1px solid var(--accent-color);
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 0px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

button:hover, .btn-link:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
}

button.secondary, .btn-link.secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

button.secondary:hover, .btn-link.secondary:hover {
    background-color: var(--accent-light);
}

button.agentic {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

button.agentic:hover {
    background-color: var(--bg-color);
    color: var(--success-color);
}

button:disabled {
    background-color: transparent;
    border-color: #9ca3af;
    color: #9ca3af;
    cursor: not-allowed;
}

#log-console {
    background-color: transparent;
    padding: 16px 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 11px;
    height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.matrix-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 16px 0;
    background: transparent;
}

.chapter-editor-item {
    background: transparent;
    padding: 14px 0;
    margin-bottom: 24px;
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chapter-header-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.chapter-status {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 3px 8px;
    letter-spacing: 0.5px;
}

.status-pending { background: #f3f4f6; color: #6b7280; }
.status-running { background: #fef3c7; color: #d97706; }
.status-done { background: #000000; color: #ffffff; }

.file-upload-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.input-file-custom {
    display: block;
    width: 100%;
    padding: 12px 0;
    background: transparent;
    border-bottom: 1px dashed var(--meta-color);
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.input-file-custom input[type="file"] {
    position: absolute;
    top: 0; left: 0; opacity: 0; width: 100%; height: 100%;
    cursor: pointer;
}

.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    background: #ef4444;
    color: white;
    letter-spacing: 0.5px;
}

.agent-active {
    animation: pulse 1.5s infinite;
}

.hidden {
    display: none !important;
}

.chapter-body-preview {
    margin-top: 12px;
    padding-top: 12px;
}

.chapter-body-preview textarea {
    font-family: Georgia, serif;
    font-size: 13px;
    line-height: 1.6;
    background: transparent;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}