* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6fb;
    color: #1f2937;
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: #2563eb;
    text-decoration: none;
}

code {
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container.narrow {
    max-width: 760px;
}

.panel {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #111827;
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.nav-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-links a {
    color: #fff;
}

.muted {
    color: #6b7280;
    margin-left: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-grid label,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-grid label span {
    width: 100%;
    font-size: 14px;
    color: #374151;
}

input,
select,
button,
.btn {
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-line input {
    width: auto;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

.btn.secondary {
    background: #64748b;
}

.btn.danger {
    background: #dc2626;
}

.btn.tiny {
    padding: 6px 10px;
    font-size: 12px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.toolbar,
.batch-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f8fafc;
}

.empty {
    text-align: center;
    color: #6b7280;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.danger-text {
    margin-top: 4px;
    color: #dc2626;
    font-size: 12px;
}

.link-block {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.break-all {
    word-break: break-all;
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination a {
    padding: 8px 12px;
    border-radius: 8px;
    background: #e5e7eb;
    color: #111827;
}

.pagination a.active {
    background: #2563eb;
    color: #fff;
}

.page-front,
.page-login,
.page-install {
    min-height: 100vh;
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    background: #111827;
    color: #fff;
}

.loading-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #eff6ff;
    color: #1d4ed8;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #bfdbfe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.viewer-frame {
    width: 100%;
    height: calc(100vh - 100px);
    border: 0;
    display: block;
    background: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .topbar,
    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table {
        display: block;
        overflow-x: auto;
    }
}
