* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f5f6f8;
    color: #171717;
}

button,
input {
    font: inherit;
}

/* Auth */

.auth-body {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        radial-gradient(
            circle at top,
            #fff8cc 0,
            #f5f6f8 40%
        );
}

.auth-card {
    width: 100%;
    max-width: 420px;

    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 18px;

    padding: 32px;

    box-shadow:
        0 20px 50px rgba(0, 0, 0, .08);
}

.brand {
    margin-bottom: 32px;
}

.brand-title {
    display: inline-block;

    padding: 8px 12px;

    background: #ffd426;

    font-size: 22px;
    font-weight: 900;

    transform: rotate(-1deg);
}

.brand-subtitle {
    margin-top: 8px;

    color: #777;
    font-size: 13px;
}

.auth-title {
    margin: 0 0 24px;

    font-size: 28px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
}

.form-group input {
    width: 100%;

    border: 1px solid #d7dbe0;
    border-radius: 9px;

    padding: 11px 12px;

    outline: none;
}

.form-group input:focus {
    border-color: #111;
}

.form-error {
    font-size: 13px;
    color: #c62828;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 13px;
    color: #555;
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 9px;

    padding: 10px 16px;

    cursor: pointer;

    font-weight: 700;

    text-decoration: none;
}

.button-primary {
    background: #ffd426;
    color: #111;
}

.button-primary:hover {
    background: #f5c900;
}

.button-secondary {
    background: #f1f2f4;
    color: #222;
}

.button-secondary:hover {
    background: #e5e7eb;
}

.button-full {
    width: 100%;
}

/* Admin */

.layout {
    min-height: 100vh;
}

.topbar {
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 32px;

    background: #fff;

    border-bottom: 1px solid #e5e7eb;
}

.topbar-title {
    font-size: 19px;
    font-weight: 900;
}

.topbar-subtitle {
    margin-top: 2px;

    font-size: 11px;
    color: #999;

    text-transform: uppercase;
    letter-spacing: .12em;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 18px;

    color: #666;
    font-size: 13px;
}

.content {
    max-width: 1440px;

    margin: 0 auto;
    padding: 32px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0;

    font-size: 30px;
}

.page-header p {
    margin: 5px 0 0;

    color: #888;
}

.stats {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 28px;
}

.stat-card {
    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    padding: 20px;
}

.stat-label {
    font-size: 13px;
    color: #777;
}

.stat-value {
    margin-top: 10px;

    font-size: 30px;
    line-height: 1;

    font-weight: 800;
}

.panel {
    overflow: hidden;

    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

.panel-header {
    padding: 20px 22px;

    border-bottom: 1px solid #eceef0;
}

.panel-header h2 {
    margin: 0;

    font-size: 18px;
}

.panel-header p {
    margin: 5px 0 0;

    font-size: 13px;
    color: #999;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;

    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 18px;

    border-bottom: 1px solid #f0f1f2;

    text-align: left;
}

.table th {
    background: #fafafa;

    font-size: 12px;
    color: #777;

    text-transform: uppercase;
    letter-spacing: .04em;
}

.table td {
    font-size: 14px;
}

.table tbody tr:hover {
    background: #fcfcfc;
}

.mono {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;
}

.empty {
    padding: 50px !important;

    text-align: center !important;
    color: #999;
}

.status {
    display: inline-flex;

    padding: 5px 8px;

    border-radius: 999px;

    background: #eee;

    font-size: 12px;
    font-weight: 700;
}

.status-ready {
    background: #ddf7e5;
    color: #137333;
}

.status-failed {
    background: #fde2e2;
    color: #b3261e;
}

.status-image1-ready,
.status-image2-ready {
    background: #fff3c4;
    color: #765a00;
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .topbar {
        padding: 0 18px;
    }

    .content {
        padding: 20px;
    }
}

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

    .topbar-user > span {
        display: none;
    }
}

.post-code {
    margin-bottom: 6px;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        monospace;

    font-size: 13px;
    color: #999;
}

.post-info {
    margin-bottom: 28px;
}

.post-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.post-meta > div {
    padding: 18px 20px;
    border-right: 1px solid #eee;
}

.post-meta > div:last-child {
    border-right: 0;
}

.post-meta span {
    display: block;
    margin-bottom: 7px;

    font-size: 12px;
    color: #888;
}

.post-meta strong {
    font-size: 14px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 20px;

    margin-bottom: 28px;
}

.image-card {
    overflow: hidden;

    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

.image-card-header {
    padding: 12px 16px;

    border-bottom: 1px solid #eee;

    font-size: 13px;
    font-weight: 700;
}

.image-card img {
    display: block;

    width: 100%;
    aspect-ratio: 4 / 5;

    object-fit: cover;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    aspect-ratio: 4 / 5;

    background: #f5f5f5;

    color: #aaa;
}

.generation-box {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 24px;

    padding: 14px 18px;

    background: #fff8d6;

    border: 1px solid #f1dd75;
    border-radius: 10px;
}

.spinner {
    width: 18px;
    height: 18px;

    border: 2px solid #d4bd48;
    border-top-color: #222;
    border-radius: 50%;

    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.alert {
    margin-bottom: 20px;

    padding: 14px 18px;

    border-radius: 10px;
}

.alert-success {
    background: #e4f7e9;
    color: #166534;
}

.alert-error {
    background: #fde8e8;
    color: #991b1b;
}

.publication {
    margin-top: 28px;
}

.publication-text {
    padding: 22px;

    max-width: 850px;

    font-size: 16px;
    line-height: 1.65;
}

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

    .post-meta {
        grid-template-columns: repeat(2, 1fr);
    }
}

.button-danger {
    background: #dc2626;
    color: #fff;
}

.button-danger:hover {
    background: #b91c1c;
}

.error-message {
    margin-top: 8px;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size: 13px;
    line-height: 1.5;

    white-space: pre-wrap;
    word-break: break-word;
}

.table-actions {
    width: 1%;
    white-space: nowrap;
}

.table-actions .button {
    padding: 7px 12px;
    font-size: 13px;
}
