html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #dedede;
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
}

* {
    box-sizing: border-box;
}

.toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 46px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: #f6f6f6;
    border-bottom: 1px solid #c8c8c8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.toolbar button,
.toolbar-link {
    min-height: 32px;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    background: #fff;
    color: #222;
    font-size: 13px;
    line-height: 20px;
    padding: 5px 9px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.toolbar button:hover,
.toolbar-link:hover {
    background: #ececec;
}

.toolbar button:disabled {
    opacity: 0.45;
    cursor: default;
}

.page-control {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 13px;
}

.page-control input {
    width: 48px;
    height: 32px;
    padding: 4px;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    background: #fff;
    text-align: center;
    font-size: 13px;
}

.zoom-label {
    min-width: 48px;
    text-align: center;
    font-size: 13px;
    white-space: nowrap;
}

.viewer {
    position: absolute;
    top: 46px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    padding: 14px 14px 30px;
    text-align: center;
    -webkit-overflow-scrolling: touch;
}

.pdf-page {
    position: relative;
    margin: 0 auto 14px;
    background: #fff;
    box-shadow: 0 1px 7px rgba(0, 0, 0, 0.22);
    line-height: 0;
}

.pdf-page canvas {
    display: block;
    width: 100%;
    height: auto;
}

.status,
.error-box {
    position: absolute;
    top: 64px;
    left: 50%;
    z-index: 30;
    transform: translateX(-50%);
    max-width: calc(100% - 30px);
    padding: 10px 14px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16);
    font-size: 14px;
    line-height: 1.4;
}

.status.hidden {
    display: none;
}

.error-box {
    color: #8a1f11;
}

.error-link {
    display: inline-block;
    margin-top: 8px;
}

@media (max-width: 680px) {
    .toolbar {
        height: 84px;
        flex-wrap: wrap;
        align-content: center;
        justify-content: center;
        padding: 5px 6px;
    }

    .toolbar-group {
        flex: 1 1 auto;
        justify-content: center;
    }

    .toolbar-right {
        width: 100%;
    }

    .viewer {
        top: 84px;
        padding: 8px 6px 20px;
    }

    .toolbar button,
    .toolbar-link,
    .page-control input {
        min-height: 30px;
        font-size: 12px;
    }

    .fit-button {
        display: none;
    }
}

@media print {
    html,
    body {
        height: auto;
        overflow: visible;
        background: #fff;
    }

    .toolbar,
    .status {
        display: none !important;
    }

    .viewer {
        position: static;
        overflow: visible;
        padding: 0;
    }

    .pdf-page {
        margin: 0;
        box-shadow: none;
        page-break-after: always;
        break-after: page;
    }
}
