:root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    color: #171717;
    background: #efefeb;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
a { color: inherit; }

.admin-shell {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 80px;
}

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

.eyebrow,
.panel-label {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(32px, 6vw, 58px);
    line-height: 1.1;
}

h2 {
    margin: 0;
    font-size: clamp(24px, 4vw, 38px);
    line-height: 1.2;
}

.overall {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.overall.is-ok { background: #dff7e7; color: #126a34; }
.overall.is-error { background: #ffe5e2; color: #9a2016; }

.panel {
    margin-bottom: 20px;
    padding: clamp(22px, 5vw, 44px);
    border: 1px solid #d8d8d2;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .05);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
}

.lead {
    max-width: 780px;
    margin: 24px 0 30px;
    line-height: 1.85;
    color: #454545;
}

.compact-meta {
    min-width: 300px;
    margin: 0;
    border-top: 1px solid #e2e2dc;
}

.compact-meta div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e2dc;
    font-size: 13px;
}

.compact-meta dt { font-weight: 700; }
.compact-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

.mode-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.mode-fieldset legend {
    margin-bottom: 12px;
    font-weight: 800;
}

.mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mode-card {
    position: relative;
    display: block;
    cursor: pointer;
}

.mode-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mode-card-body {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: 1px solid #d9d9d3;
    border-radius: 17px;
    background: #fafaf7;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.mode-card-body strong { font-size: 18px; }
.mode-card-body small { color: #666; line-height: 1.6; }

.mode-card input:checked + .mode-card-body {
    border-color: #171717;
    background: #fff;
    box-shadow: inset 0 0 0 1px #171717;
}

.mode-card input:focus-visible + .mode-card-body {
    outline: 3px solid rgba(23, 23, 23, .2);
    outline-offset: 2px;
}

.theme-field {
    margin-top: 18px;
    padding: 20px;
    border: 1px solid #deded8;
    border-radius: 17px;
    background: #f8f8f5;
}

.theme-field label {
    display: block;
    margin-bottom: 9px;
    font-weight: 800;
}

.theme-field input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid #cacac4;
    border-radius: 12px;
    color: #171717;
    background: #fff;
}

.theme-field input:focus {
    outline: 3px solid rgba(23, 23, 23, .14);
    border-color: #171717;
}

.theme-field p {
    margin: 8px 0 0;
    color: #777;
    font-size: 12px;
}

.notice {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 20px 0;
    padding: 16px 18px;
    border-radius: 14px;
    line-height: 1.55;
}

.notice.is-warning {
    color: #784c00;
    background: #fff3cf;
    border: 1px solid #eed996;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 24px;
}

.primary-button {
    min-height: 54px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #171717;
    font-weight: 800;
    cursor: pointer;
}

.primary-button:hover:not(:disabled) { transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .4; }

.form-note {
    color: #777;
    font-size: 12px;
    line-height: 1.6;
}

.job-card {
    margin-top: 28px;
    padding: 22px;
    border: 1px solid #deded8;
    border-radius: 18px;
    background: #f8f8f5;
}

.job-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.status-badge {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    background: #e8e8e3;
    font-size: 12px;
    font-weight: 900;
}

.status-badge[data-status="completed"] { color: #126a34; background: #dff7e7; }
.status-badge[data-status="failed"] { color: #9a2016; background: #ffe5e2; }
.status-badge[data-status="in_progress"],
.status-badge[data-status="queued"] { color: #174a87; background: #dfeeff; }

.progress-track {
    height: 8px;
    margin: 15px 0 20px;
    overflow: hidden;
    border-radius: 999px;
    background: #deded8;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #171717;
    transition: width .35s ease;
}

.job-card h3 { margin: 0; font-size: 20px; }

.job-detail {
    min-height: 1.6em;
    margin: 10px 0 18px;
    color: #555;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.job-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0;
}

.job-meta div {
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
}

.job-meta dt {
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 800;
    color: #777;
}

.job-meta dd {
    margin: 0;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.article-preview {
    margin-top: 24px;
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid #d6d6d0;
    border-radius: 20px;
    background: #fff;
}

.article-preview.is-no-news {
    border-color: #e8d18b;
    background: #fffaf0;
}

.preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e4e4de;
}

.preview-heading h3 {
    margin: 0;
    font-size: clamp(24px, 4vw, 36px);
    line-height: 1.35;
}

.character-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: #f0f0ec;
    color: #555;
    font-size: 12px;
    font-weight: 800;
}

.preview-message {
    margin: 20px 0 0;
    color: #735300;
    line-height: 1.8;
}

.preview-meta {
    display: grid;
    gap: 0;
    margin: 24px 0;
    border-top: 1px solid #e4e4de;
}

.preview-meta div {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid #e4e4de;
}

.preview-meta dt { font-weight: 800; }
.preview-meta dd { margin: 0; color: #555; line-height: 1.65; overflow-wrap: anywhere; }

.preview-lead {
    margin: 28px 0;
    padding: 20px;
    border-left: 4px solid #171717;
    background: #f7f7f3;
    font-weight: 700;
    line-height: 1.9;
}

.preview-block { margin-top: 28px; }
.preview-block h4,
.preview-section h4 {
    margin: 0 0 12px;
    font-size: 20px;
}

.preview-block p,
.preview-section p,
.preview-block li {
    line-height: 1.9;
}

.preview-block ul { margin: 0; padding-left: 1.4em; }

.preview-section {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid #e4e4de;
}

.source-list {
    display: grid;
    gap: 12px;
    padding: 0 !important;
    list-style: none;
}

.source-list li {
    padding: 14px;
    border: 1px solid #e2e2dc;
    border-radius: 13px;
}

.source-list a {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.source-list span {
    display: block;
    margin-top: 4px;
    color: #777;
    font-size: 12px;
}

.management-heading { align-items: center; }
.article-total {
    padding: 8px 12px;
    border-radius: 999px;
    background: #f0f0ec;
    font-size: 13px;
    font-weight: 800;
}

.empty-state {
    margin-top: 24px;
    padding: 30px;
    border: 1px dashed #cfcfc8;
    border-radius: 18px;
    text-align: center;
    background: #fafaf7;
}

.empty-state strong { font-size: 18px; }
.empty-state p { margin: 8px 0 0; color: #777; }

.article-list {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.article-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
    border: 1px solid #e2e2dc;
    border-radius: 14px;
}

.article-row div { display: flex; flex-direction: column; gap: 5px; }
.article-row time { color: #777; font-size: 12px; }
.article-row a { font-size: 13px; font-weight: 800; }

.error-panel { border-color: #e7b8b2; }
.error-panel p:last-child { margin-bottom: 0; color: #9a2016; overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .admin-shell { width: min(100% - 20px, 1040px); padding-top: 28px; }
    .admin-header,
    .panel-heading,
    .preview-heading,
    .form-actions { align-items: flex-start; flex-direction: column; }
    .compact-meta { width: 100%; min-width: 0; }
    .mode-options,
    .job-meta { grid-template-columns: 1fr; }
    .preview-meta div { grid-template-columns: 1fr; gap: 4px; }
    .article-row { align-items: flex-start; flex-direction: column; }
}
