:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #19202a;
    --muted: #637083;
    --line: #d9e0e8;
    --accent: #1267a8;
    --accent-strong: #0a4f82;
    --danger: #b4232c;
    --danger-strong: #8f1720;
    --success-bg: #e7f7ed;
    --success-text: #17603a;
    --error-bg: #fdebec;
    --error-text: #9d1c2b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

.locked-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7f8;
}

.unavailable-shell {
    width: min(680px, calc(100% - 32px));
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 0;
}

.unavailable-panel {
    text-align: center;
    color: #30343b;
}

.unavailable-code {
    margin: 0 0 14px;
    color: #8b93a1;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.unavailable-panel h1 {
    margin: 0 0 12px;
    color: #232832;
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.12;
    letter-spacing: 0;
}

.unavailable-panel p {
    margin: 0 auto;
    max-width: 520px;
    color: #667085;
    font-size: 16px;
    line-height: 1.6;
}

button,
input,
textarea {
    font: inherit;
}

.shell {
    width: min(1060px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    align-items: start;
    padding: 32px 0;
}

.panel {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 18px 48px rgba(18, 34, 55, 0.08);
}

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

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.1;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 0;
}

form {
    margin: 0;
}

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

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
    min-height: 48px;
    padding: 0 14px;
}

textarea {
    min-height: 220px;
    padding: 14px;
    line-height: 1.5;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(18, 103, 168, 0.14);
}

button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    color: #fff;
    background: var(--accent);
    font-weight: 800;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

button:hover {
    background: var(--accent-strong);
}

button:active {
    transform: translateY(1px);
}

.ghost-button {
    color: var(--accent);
    background: #eef6fc;
}

.ghost-button:hover {
    color: #fff;
    background: var(--accent);
}

.danger-button {
    color: #fff;
    background: var(--danger);
}

.danger-button:hover {
    background: var(--danger-strong);
}

.entry-card .danger-button {
    color: #fff;
    background: var(--danger);
}

.entry-card .danger-button:hover {
    background: var(--danger-strong);
}

.small-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.inline-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.text-toolbar,
.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.text-toolbar {
    margin-bottom: 8px;
}

.text-toolbar label {
    margin-bottom: 0;
}

.form-footer {
    margin-top: 14px;
}

.status {
    min-height: 22px;
    color: var(--muted);
    font-size: 14px;
}

.notice {
    margin-bottom: 18px;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.notice-success {
    color: var(--success-text);
    background: var(--success-bg);
}

.notice-error {
    color: var(--error-text);
    background: var(--error-bg);
}

.image-panel {
    margin-top: 16px;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    min-height: 58px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfe;
}

.pending-image {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.pending-image img {
    width: 84px;
    height: 84px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: #fff;
}

.pending-image-meta {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.pending-image-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entries-section {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.section-header,
.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-header {
    margin-bottom: 18px;
}

.entries-list {
    display: grid;
    gap: 20px;
}

.entry-card {
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    box-shadow: 0 10px 26px rgba(18, 34, 55, 0.06);
    overflow: hidden;
}

.entry-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #f7f9fb;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
}

.entry-number {
    color: var(--text);
    font-weight: 800;
}

.entry-body {
    display: grid;
    gap: 16px;
    padding: 16px;
}

.entry-part {
    display: grid;
    gap: 8px;
}

.entry-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.entry-content {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
    background: #fff;
    font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.entry-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 0;
}

.entry-images a {
    display: block;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.entry-images img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

.empty-state {
    margin: 0;
    align-self: center;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 560px) {
    .shell {
        width: min(100% - 20px, 1060px);
        align-items: start;
        padding: 10px 0;
    }

    .panel {
        padding: 20px;
    }

    .header,
    .inline-row,
    .text-toolbar,
    .form-footer,
    .section-header,
    .entry-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    button {
        width: 100%;
    }

    .pending-image {
        grid-template-columns: 72px 1fr;
    }

    .pending-image img {
        width: 72px;
        height: 72px;
    }

    .entry-header,
    .entry-body {
        padding: 12px;
    }
}
